I freshly installed Qt Creator with MinGW and Cmake. I'm trying to play with OpenGL. So far I got this code:
#include <GLFW/glfw3.h>
int main()
{
if (!glfwInit()) {
return -1;
}
return 0;
}
My CMakeLists.txt is like this:
cmake_minimum_required(VERSION 2.8)
project(world_0)
aux_source_directory(. SRC_LIST)
file(GLOB SRC_LIST *.cpp)
find_package(GLFW3 REQUIRED)
include_directories(F:/u_qt/libs/glfw/glfw-3.0.1/include)
link_directories(F:/u_qt/libs/glfw/glfw-3.0.1/lib-mingw)
add_executable(${PROJECT_NAME} ${SRC_LIST})
target_link_libraries(${PROJECT_NAME} glfw3)
I've added FindGLFW3.cmake from "FindGLFW3.make". But still got 'undefined reference' error.
I will be glad to hear any feedback from you guys. Cheers.
From the FindGLFW3.cmake file you linked to, it looks like the last half of your CMakeLists.txt should be changed to something like:
find_package(GLFW3 REQUIRED)
include_directories(${GLFW3_INCLUDE_PATH})
add_executable(${PROJECT_NAME} ${SRC_LIST})
target_link_libraries(${PROJECT_NAME} ${GLFW3_LIBRARY})