mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 01:55:09 +00:00
Improved CMake config file generation.
This commit is contained in:
parent
2b57d176df
commit
fe7a4eb4ff
4
.gitignore
vendored
4
.gitignore
vendored
@ -23,8 +23,8 @@ docs/html
|
|||||||
docs/warnings.txt
|
docs/warnings.txt
|
||||||
src/glfw_config.h
|
src/glfw_config.h
|
||||||
src/glfw3.pc
|
src/glfw3.pc
|
||||||
src/glfwConfig.cmake
|
src/glfw3Config.cmake
|
||||||
src/glfwConfigVersion.cmake
|
src/glfw3ConfigVersion.cmake
|
||||||
|
|
||||||
# Compiled binaries
|
# Compiled binaries
|
||||||
src/libglfw.so
|
src/libglfw.so
|
||||||
|
@ -509,6 +509,24 @@ endif()
|
|||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Create generated files
|
# Create generated files
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
|
if (UNIX)
|
||||||
|
set(GLFW_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/lib/cmake/glfw3/")
|
||||||
|
else()
|
||||||
|
set(GLFW_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
configure_package_config_file("${GLFW_SOURCE_DIR}/src/glfw3Config.cmake.in"
|
||||||
|
"${GLFW_BINARY_DIR}/src/glfw3Config.cmake"
|
||||||
|
INSTALL_DESTINATION "${GLFW_CONFIG_PATH}"
|
||||||
|
PATH_VARS CMAKE_INSTALL_PREFIX
|
||||||
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
||||||
|
|
||||||
|
write_basic_package_version_file("${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake"
|
||||||
|
VERSION ${GLFW_VERSION_FULL}
|
||||||
|
COMPATIBILITY SameMajorVersion)
|
||||||
|
|
||||||
if (GLFW_BUILD_DOCS)
|
if (GLFW_BUILD_DOCS)
|
||||||
configure_file("${GLFW_SOURCE_DIR}/docs/Doxyfile.in"
|
configure_file("${GLFW_SOURCE_DIR}/docs/Doxyfile.in"
|
||||||
"${GLFW_BINARY_DIR}/docs/Doxyfile" @ONLY)
|
"${GLFW_BINARY_DIR}/docs/Doxyfile" @ONLY)
|
||||||
@ -517,12 +535,6 @@ endif()
|
|||||||
configure_file("${GLFW_SOURCE_DIR}/src/glfw_config.h.in"
|
configure_file("${GLFW_SOURCE_DIR}/src/glfw_config.h.in"
|
||||||
"${GLFW_BINARY_DIR}/src/glfw_config.h" @ONLY)
|
"${GLFW_BINARY_DIR}/src/glfw_config.h" @ONLY)
|
||||||
|
|
||||||
configure_file("${GLFW_SOURCE_DIR}/src/glfwConfig.cmake.in"
|
|
||||||
"${GLFW_BINARY_DIR}/src/glfwConfig.cmake" @ONLY)
|
|
||||||
|
|
||||||
configure_file("${GLFW_SOURCE_DIR}/src/glfwConfigVersion.cmake.in"
|
|
||||||
"${GLFW_BINARY_DIR}/src/glfwConfigVersion.cmake" @ONLY)
|
|
||||||
|
|
||||||
configure_file("${GLFW_SOURCE_DIR}/src/glfw3.pc.in"
|
configure_file("${GLFW_SOURCE_DIR}/src/glfw3.pc.in"
|
||||||
"${GLFW_BINARY_DIR}/src/glfw3.pc" @ONLY)
|
"${GLFW_BINARY_DIR}/src/glfw3.pc" @ONLY)
|
||||||
|
|
||||||
@ -551,8 +563,8 @@ if (GLFW_INSTALL)
|
|||||||
install(DIRECTORY include/GLFW DESTINATION include
|
install(DIRECTORY include/GLFW DESTINATION include
|
||||||
FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h)
|
FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h)
|
||||||
|
|
||||||
install(FILES "${GLFW_BINARY_DIR}/src/glfwConfig.cmake"
|
install(FILES "${GLFW_BINARY_DIR}/src/glfw3Config.cmake"
|
||||||
"${GLFW_BINARY_DIR}/src/glfwConfigVersion.cmake"
|
"${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake"
|
||||||
DESTINATION lib${LIB_SUFFIX}/cmake/glfw)
|
DESTINATION lib${LIB_SUFFIX}/cmake/glfw)
|
||||||
|
|
||||||
install(EXPORT glfwTargets DESTINATION lib${LIB_SUFFIX}/cmake/glfw)
|
install(EXPORT glfwTargets DESTINATION lib${LIB_SUFFIX}/cmake/glfw)
|
||||||
|
15
src/glfw3Config.cmake.in
Normal file
15
src/glfw3Config.cmake.in
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# - Config file for the glfw3 package
|
||||||
|
# It defines the following variables
|
||||||
|
# GLFW3_INCLUDE_DIR, the path where GLFW headers are located
|
||||||
|
# GLFW3_LIBRARY_DIR, folder in which the GLFW library is located
|
||||||
|
# GLFW3_LIBRARY, library to link against to use GLFW
|
||||||
|
|
||||||
|
set(GLFW3_VERSION "@GLFW_VERSION_FULL@")
|
||||||
|
|
||||||
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
|
set_and_check(GLFW3_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/include")
|
||||||
|
set_and_check(GLFW3_LIBRARY_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@")
|
||||||
|
|
||||||
|
find_library(GLFW3_LIBRARY "@GLFW_LIB_NAME@" HINTS ${GLFW3_LIBRARY_DIR})
|
||||||
|
|
@ -1,10 +0,0 @@
|
|||||||
# - Config file for the glfw package
|
|
||||||
# It defines the following variables
|
|
||||||
# GLFW_INCLUDE_DIR, the path where GLFW headers are located
|
|
||||||
# GLFW_LIBRARY_DIR, folder in which the GLFW library is located
|
|
||||||
# GLFW_LIBRARY, library to link against to use GLFW
|
|
||||||
|
|
||||||
set(GLFW_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include")
|
|
||||||
set(GLFW_LIBRARY_DIR "@CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@")
|
|
||||||
|
|
||||||
find_library(GLFW_LIBRARY "@GLFW_LIB_NAME@" HINTS ${GLFW_LIBRARY_DIR})
|
|
@ -1,12 +0,0 @@
|
|||||||
|
|
||||||
set(PACKAGE_VERSION "@GLFW_VERSION_FULL@")
|
|
||||||
|
|
||||||
if ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL "@GLFW_VERSION_MAJOR@")
|
|
||||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
|
||||||
if ("${PACKAGE_FIND_VERSION_MINOR}" EQUAL @GLFW_VERSION_MINOR@)
|
|
||||||
set(PACKAGE_VERSION_EXACT TRUE)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
|
||||||
endif()
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user