Make GSL a CMake consumable header-only library

This commit is contained in:
Johel Ernesto Guerrero Peña 2017-03-12 17:16:46 -04:00
parent 5905d2d774
commit 8782e6c6c4
2 changed files with 12 additions and 6 deletions

View File

@ -1,11 +1,17 @@
cmake_minimum_required(VERSION 2.8.7) cmake_minimum_required(VERSION 3.0.0)
project(GSL CXX) project(GSL CXX)
install( add_library(cppgsl INTERFACE)
DIRECTORY include/gsl target_include_directories(cppgsl INTERFACE
DESTINATION include $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
) $<INSTALL_INTERFACE:include>)
install(TARGETS cppgsl EXPORT cppgslConfig)
install(DIRECTORY include/gsl DESTINATION include)
export(EXPORT cppgslConfig)
install(EXPORT cppgslConfig DESTINATION cmake)
enable_testing() enable_testing()
add_subdirectory(tests) add_subdirectory(tests)

View File

@ -34,7 +34,7 @@ endif()
function(add_gsl_test name) function(add_gsl_test name)
add_executable(${name} ${name}.cpp) add_executable(${name} ${name}.cpp)
target_link_libraries(${name} UnitTest++) target_link_libraries(${name} UnitTest++ cppgsl)
add_test( add_test(
${name} ${name}
${name} ${name}