Make GSL easier consumed by another project.

Changes:
- Switched old include_directories function for the newer target_include_directories.
- Added GSL as a INTERFACE library
- Added GSL project to the tests CMakeLists.txt so It can include it automatically.
This commit is contained in:
GitLab 2016-09-20 11:05:40 -03:00
parent 8361aae39e
commit 81204295be
2 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.7) cmake_minimum_required(VERSION 2.8.12)
project(GSL CXX) project(GSL CXX)
@ -12,9 +12,9 @@ set(GSL_HEADERS
"gsl/string_span" "gsl/string_span"
) )
include_directories( add_library(${PROJECT_NAME} INTERFACE)
${CMAKE_CURRENT_BINARY_DIR}
) target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
install(FILES ${GSL_HEADERS} install(FILES ${GSL_HEADERS}
DESTINATION include/gsl DESTINATION include/gsl

View File

@ -34,7 +34,7 @@ endif()
function(add_gsl_test name) function(add_gsl_test name)
add_executable(${name} ${name}.cpp ../gsl/gsl ../gsl/gsl_assert ../gsl/gsl_util ../gsl/multi_span ../gsl/span ../gsl/string_span) add_executable(${name} ${name}.cpp ../gsl/gsl ../gsl/gsl_assert ../gsl/gsl_util ../gsl/multi_span ../gsl/span ../gsl/string_span)
target_link_libraries(${name} UnitTest++) target_link_libraries(${name} UnitTest++ GSL)
install(TARGETS ${name} install(TARGETS ${name}
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
) )