diff --git a/docs/build.dox b/docs/build.dox index 32e19ade..6fe890df 100644 --- a/docs/build.dox +++ b/docs/build.dox @@ -159,20 +159,14 @@ add_subdirectory(path/to/glfw) @endcode Once GLFW has been added to the project, link against it with the `glfw` target. -This adds all link-time dependencies of GLFW as it is currently configured and, -when applicable, the [GLFW_DLL](@ref build_macros) macro. +This adds all link-time dependencies of GLFW as it is currently configured, +the include directory for the GLFW header and, when applicable, the +[GLFW_DLL](@ref build_macros) macro. @code{.cmake} target_link_libraries(myapp glfw) @endcode -To be able to include the GLFW header from your code, you need to tell the -compiler where to find it. - -@code{.cmake} -include_directories(path/to/glfw/include) -@endcode - Note that it does not include GLU, as GLFW does not use it. If your application needs GLU, you can find it by requiring the OpenGL package. diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 3f3f8983..7d8a41af 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -9,8 +9,7 @@ if (MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif() -include_directories("${GLFW_SOURCE_DIR}/include" - "${GLFW_SOURCE_DIR}/deps") +include_directories("${GLFW_SOURCE_DIR}/deps") if (WIN32) set(ICON glfw.rc) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2660dcac..f73daa2c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -59,6 +59,9 @@ set_target_properties(glfw PROPERTIES FOLDER "GLFW3") target_compile_definitions(glfw PRIVATE -D_GLFW_USE_CONFIG_H) +target_include_directories(glfw PUBLIC + $ + $/include>) target_include_directories(glfw PRIVATE "${GLFW_SOURCE_DIR}/src" "${GLFW_BINARY_DIR}/src" diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index afa140fa..6488ef25 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -9,8 +9,7 @@ if (MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif() -include_directories("${GLFW_SOURCE_DIR}/include" - "${GLFW_SOURCE_DIR}/deps") +include_directories("${GLFW_SOURCE_DIR}/deps") set(GLAD "${GLFW_SOURCE_DIR}/deps/glad/glad.h" "${GLFW_SOURCE_DIR}/deps/glad.c")