Export glm as interface library for CMake 2.8.12 and newer

This commit is contained in:
Zbigniew Mandziejewicz 2015-03-29 10:41:09 +08:00
parent e1c3c531dd
commit 288d1af309
2 changed files with 36 additions and 0 deletions

View File

@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 2.6 FATAL_ERROR) cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(glm) project(glm)
set(GLM_VERSION "0.9.6")
enable_testing() enable_testing()
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
@ -144,3 +146,36 @@ add_subdirectory(test)
add_subdirectory(util) add_subdirectory(util)
install(DIRECTORY glm DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}) install(DIRECTORY glm DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR})
if (NOT CMAKE_VERSION VERSION_LESS "2.8.12")
add_library(glm INTERFACE)
target_include_directories(glm INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
install(TARGETS glm EXPORT glmTargets)
set(GLM_INSTALL_CONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/glm")
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/glmVersion.cmake"
VERSION ${GLM_VERSION}
COMPATIBILITY AnyNewerVersion
)
export(
EXPORT glmTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/glmTargets.cmake"
)
install(
EXPORT glmTargets FILE glmTargets.cmake
DESTINATION ${GLM_INSTALL_CONFIG_DIR}
)
install(
FILES
cmake/glmConfig.cmake
"${CMAKE_CURRENT_BINARY_DIR}/glmVersion.cmake"
DESTINATION ${GLM_INSTALL_CONFIG_DIR}
)
endif()

1
cmake/glmConfig.cmake Normal file
View File

@ -0,0 +1 @@
include("${CMAKE_CURRENT_LIST_DIR}/glmTargets.cmake")