Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/GSL.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Reinhold <sre@informatik.uni-kiel.de>2018-07-17 11:23:44 +0300
committerStefan Reinhold <sre@informatik.uni-kiel.de>2018-07-17 11:23:44 +0300
commitd452c3b061549008404b81e359c8a8e3f2f043de (patch)
tree3dfe740addaf6e884f6b4df4bba5301fa3992090 /CMakeLists.txt
parent5778149583e69b34ab375039ffcc5d51a4dd7b37 (diff)
Make library importable by CMake using find_package
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt14
1 files changed, 13 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b0de85d..8259516 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,9 @@ project(GSL CXX)
include(ExternalProject)
find_package(Git)
+# Use GNUInstallDirs to provide the right locations on all platforms
+include(GNUInstallDirs)
+
# creates a library GSL which is an interface (header files only)
add_library(GSL INTERFACE)
@@ -55,6 +58,7 @@ target_include_directories(GSL INTERFACE
$<BUILD_INTERFACE:
${CMAKE_CURRENT_SOURCE_DIR}/include
>
+ $<INSTALL_INTERFACE:include>
)
if ((CMAKE_VERSION GREATER 3.7.9) OR (CMAKE_VERSION EQUAL 3.7.9))
@@ -72,10 +76,18 @@ if ((CMAKE_VERSION GREATER 3.7.9) OR (CMAKE_VERSION EQUAL 3.7.9))
endif()
endif()
+install(TARGETS GSL EXPORT GSLConfig
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+)
install(
DIRECTORY include/gsl
- DESTINATION include
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
+# Make library importable by other projects
+install(EXPORT GSLConfig DESTINATION share/GSL/cmake)
+export(TARGETS GSL FILE GSLConfig.cmake)
option(GSL_TEST "Generate tests." ${GSL_STANDALONE_PROJECT})
if (GSL_TEST)