From 8782e6c6c422ba64cc8febbf4553e96523abba7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johel=20Ernesto=20Guerrero=20Pe=C3=B1a?= Date: Sun, 12 Mar 2017 17:16:46 -0400 Subject: [PATCH] Make GSL a CMake consumable header-only library --- CMakeLists.txt | 16 +++++++++++----- tests/CMakeLists.txt | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b96546..7f8aff3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,17 @@ -cmake_minimum_required(VERSION 2.8.7) +cmake_minimum_required(VERSION 3.0.0) project(GSL CXX) -install( - DIRECTORY include/gsl - DESTINATION include -) +add_library(cppgsl INTERFACE) +target_include_directories(cppgsl INTERFACE + $ + $) + +install(TARGETS cppgsl EXPORT cppgslConfig) +install(DIRECTORY include/gsl DESTINATION include) + +export(EXPORT cppgslConfig) +install(EXPORT cppgslConfig DESTINATION cmake) enable_testing() add_subdirectory(tests) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 40c46d5..e01e83d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -34,7 +34,7 @@ endif() function(add_gsl_test name) add_executable(${name} ${name}.cpp) - target_link_libraries(${name} UnitTest++) + target_link_libraries(${name} UnitTest++ cppgsl) add_test( ${name} ${name}