Introduces install path variables.

Adds variables for GLFW_INSTALL_{LIBRARY,INCLUDE,CONFIG,PKGCONFIG}_DIR,
which enforces consistency between our install paths and paths exported via glfw3Config.cmake.
This commit is contained in:
Nicholas Vitovitch 2015-03-10 23:54:39 -04:00 committed by Zbigniew Mandziejewicz
parent 016d0e105f
commit 6eeecb1b22
2 changed files with 13 additions and 14 deletions

View File

@ -478,15 +478,14 @@ endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
if (UNIX) set(GLFW_INSTALL_INCLUDE_DIR "include")
set(GLFW_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/cmake/glfw3/") set(GLFW_INSTALL_LIBRARY_DIR "lib${LIB_SUFFIX}")
else() set(GLFW_INSTALL_CONFIG_DIR "lib${LIB_SUFFIX}/cmake/glfw3")
set(GLFW_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/") set(GLFW_INSTALL_PKGCONFIG_DIR "lib${LIB_SUFFIX}/pkgconfig")
endif()
configure_package_config_file("${GLFW_SOURCE_DIR}/src/glfw3Config.cmake.in" configure_package_config_file("${GLFW_SOURCE_DIR}/src/glfw3Config.cmake.in"
"${GLFW_BINARY_DIR}/src/glfw3Config.cmake" "${GLFW_BINARY_DIR}/src/glfw3Config.cmake"
INSTALL_DESTINATION "${GLFW_CONFIG_PATH}" INSTALL_DESTINATION "${GLFW_INSTALL_CONFIG_DIR}"
PATH_VARS CMAKE_INSTALL_PREFIX PATH_VARS CMAKE_INSTALL_PREFIX
NO_CHECK_REQUIRED_COMPONENTS_MACRO) NO_CHECK_REQUIRED_COMPONENTS_MACRO)
@ -527,18 +526,18 @@ endif()
# The library is installed by src/CMakeLists.txt # The library is installed by src/CMakeLists.txt
#-------------------------------------------------------------------- #--------------------------------------------------------------------
if (GLFW_INSTALL) if (GLFW_INSTALL)
install(DIRECTORY include/GLFW DESTINATION include install(DIRECTORY include/GLFW DESTINATION ${GLFW_INSTALL_INCLUDE_DIR}
FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h) FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h)
install(FILES "${GLFW_BINARY_DIR}/src/glfw3Config.cmake" install(FILES "${GLFW_BINARY_DIR}/src/glfw3Config.cmake"
"${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake" "${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake"
DESTINATION ${GLFW_CONFIG_PATH}) DESTINATION ${GLFW_INSTALL_CONFIG_DIR})
install(EXPORT glfwTargets FILE glfw3Targets.cmake install(EXPORT glfwTargets FILE glfw3Targets.cmake
DESTINATION ${GLFW_CONFIG_PATH}) DESTINATION ${GLFW_INSTALL_CONFIG_DIR})
install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc" install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc"
DESTINATION lib${LIB_SUFFIX}/pkgconfig) DESTINATION ${GLFW_INSTALL_PKGCONFIG_DIR})
# Only generate this target if no higher-level project already has # Only generate this target if no higher-level project already has
if (NOT TARGET uninstall) if (NOT TARGET uninstall)

View File

@ -8,8 +8,8 @@ set(GLFW3_VERSION "@GLFW_VERSION_FULL@")
@PACKAGE_INIT@ @PACKAGE_INIT@
set_and_check(GLFW3_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/include") set_and_check(GLFW3_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/@GLFW_INSTALL_INCLUDE_DIR@")
set_and_check(GLFW3_LIBRARY_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@") set_and_check(GLFW3_LIBRARY_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/@GLFW_INSTALL_INCLUDE_DIR@")
include("@PACKAGE_CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@/cmake/glfw/glfw3Targets.cmake") include("@PACKAGE_CMAKE_INSTALL_PREFIX@/@GLFW_INSTALL_CONFIG_DIR@/glfw3Targets.cmake")
set(GLFW3_LIBRARY glfw) set(GLFW3_LIBRARY glfw)