Export transitive dependencies for static library

This commit is contained in:
Nicholas Vitovitch
2016-02-02 00:41:20 +01:00
committed by Camilla Berglund
parent 8637612908
commit 453631773e
5 changed files with 17 additions and 15 deletions
+14 -9
View File
@@ -158,6 +158,14 @@ will add the `glfw` target and the necessary cache variables to your project.
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.
@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.
@@ -165,21 +173,18 @@ compiler where to find it.
include_directories(path/to/glfw/include)
@endcode
Once GLFW has been added to the project, the `GLFW_LIBRARIES` cache variable
contains all link-time dependencies of GLFW as it is currently configured. To
link against GLFW, link against them and the `glfw` target.
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.
@code{.cmake}
target_link_libraries(myapp glfw ${GLFW_LIBRARIES})
find_package(OpenGL REQUIRED)
@endcode
Note that `GLFW_LIBRARIES` does not include GLU, as GLFW does not use it. If
your application needs GLU, you can add it to the list of dependencies with the
`OPENGL_glu_LIBRARY` cache variable, which is implicitly created when the GLFW
CMake files look for OpenGL.
Once found, the GLU library path is stored in the `OPENGL_glu_LIBRARY` cache
variable.
@code{.cmake}
target_link_libraries(myapp glfw ${OPENGL_glu_LIBRARY} ${GLFW_LIBRARIES})
target_link_libraries(myapp glfw ${OPENGL_glu_LIBRARY})
@endcode