Hello,
I’m trying to compile a project to start learning OpenGl, but I can’t.
When I run CMake -G "Unix Makefiles" ..
it generates the MakeFile without any warning. When running Make, it fails to compile. Here’s the error raised.
fatal error: GLFW/glfw3.h: No such file or directory
2 | #include <GLFW/glfw3.h>
Here is my CMakeLists.txt
where I added the library.
cmake_minimum_required(VERSION 3.9.1)
project(TEST)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
add_library(GLFW STATIC IMPORTED GLOBAL)
set_target_properties(GLFW PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/external/GLFW/libglfw3.a )
set_target_properties(GLFW PROPERTIES INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/external)
add_executable(hello ${CMAKE_SOURCE_DIR}/src/main.cpp)
target_link_libraries(hello GLFW)
My project tree:
root\
external\
GLFW\
glfw3.h
libglfw3.a
src\
main.cpp
build\
CMakeLists.txt
Do you have any idea of what’s wrong? Thanks ^^’