From 288d1af3096b09374338a9f5202ee148cbc31b03 Mon Sep 17 00:00:00 2001 From: Zbigniew Mandziejewicz Date: Sun, 29 Mar 2015 10:41:09 +0800 Subject: [PATCH] Export glm as interface library for CMake 2.8.12 and newer --- CMakeLists.txt | 35 +++++++++++++++++++++++++++++++++++ cmake/glmConfig.cmake | 1 + 2 files changed, 36 insertions(+) create mode 100644 cmake/glmConfig.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 5925d5fe..329b846a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 2.6 FATAL_ERROR) project(glm) +set(GLM_VERSION "0.9.6") + enable_testing() list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") @@ -144,3 +146,36 @@ add_subdirectory(test) add_subdirectory(util) 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(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() diff --git a/cmake/glmConfig.cmake b/cmake/glmConfig.cmake new file mode 100644 index 00000000..ea324ab6 --- /dev/null +++ b/cmake/glmConfig.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/glmTargets.cmake")