mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-29 02:51:59 -05:00
d0052f6320
It's much nicer and less error prone to just use add_subdirectory to establish the include directory. Hide the GNUInstallDirs module by placing it in the helper module. The intent being that the main CMakeLists.txt should have a little code as possible. So that readers can quickly understand the project. Use include_guard() when available in cmake 3.10+ Co-authored-by: Juan Ramos <juanr0911@gmail.com>
21 lines
627 B
CMake
21 lines
627 B
CMake
|
|
# Add include folders to the library and targets that consume it
|
|
# the SYSTEM keyword suppresses warnings for users of the library
|
|
#
|
|
# By adding this directory as an include directory the user gets a
|
|
# namespace effect.
|
|
#
|
|
# IE:
|
|
# #include <gsl/gsl>
|
|
if(GSL_STANDALONE_PROJECT)
|
|
target_include_directories(GSL INTERFACE
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
)
|
|
else()
|
|
target_include_directories(GSL SYSTEM INTERFACE
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
)
|
|
endif()
|