Add public header path to target interface

Closes #697.
master
Marcus Geelnard ago%!(EXTRA string=9 years) committed by Camilla Berglund
parent 453631773e
commit 075140aefe
  1. 12
      docs/build.dox
  2. 3
      examples/CMakeLists.txt
  3. 3
      src/CMakeLists.txt
  4. 3
      tests/CMakeLists.txt

@ -159,20 +159,14 @@ add_subdirectory(path/to/glfw)
@endcode @endcode
Once GLFW has been added to the project, link against it with the `glfw` target. 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, This adds all link-time dependencies of GLFW as it is currently configured,
when applicable, the [GLFW_DLL](@ref build_macros) macro. the include directory for the GLFW header and, when applicable, the
[GLFW_DLL](@ref build_macros) macro.
@code{.cmake} @code{.cmake}
target_link_libraries(myapp glfw) target_link_libraries(myapp glfw)
@endcode @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 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. needs GLU, you can find it by requiring the OpenGL package.

@ -9,8 +9,7 @@ if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif() endif()
include_directories("${GLFW_SOURCE_DIR}/include" include_directories("${GLFW_SOURCE_DIR}/deps")
"${GLFW_SOURCE_DIR}/deps")
if (WIN32) if (WIN32)
set(ICON glfw.rc) set(ICON glfw.rc)

@ -59,6 +59,9 @@ set_target_properties(glfw PROPERTIES
FOLDER "GLFW3") FOLDER "GLFW3")
target_compile_definitions(glfw PRIVATE -D_GLFW_USE_CONFIG_H) target_compile_definitions(glfw PRIVATE -D_GLFW_USE_CONFIG_H)
target_include_directories(glfw PUBLIC
$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>)
target_include_directories(glfw PRIVATE target_include_directories(glfw PRIVATE
"${GLFW_SOURCE_DIR}/src" "${GLFW_SOURCE_DIR}/src"
"${GLFW_BINARY_DIR}/src" "${GLFW_BINARY_DIR}/src"

@ -9,8 +9,7 @@ if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif() endif()
include_directories("${GLFW_SOURCE_DIR}/include" include_directories("${GLFW_SOURCE_DIR}/deps")
"${GLFW_SOURCE_DIR}/deps")
set(GLAD "${GLFW_SOURCE_DIR}/deps/glad/glad.h" set(GLAD "${GLFW_SOURCE_DIR}/deps/glad/glad.h"
"${GLFW_SOURCE_DIR}/deps/glad.c") "${GLFW_SOURCE_DIR}/deps/glad.c")

Loading…
Cancel
Save