diff options
author | hdf89shfdfs <31327577+hdf89shfdfs@users.noreply.github.com> | 2021-01-08 20:56:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-08 20:56:04 +0300 |
commit | d0052f6320553769110a1d6b260b74afb82ffb92 (patch) | |
tree | fea3ac7f244d9320ffd29c0976841f43ce468a6b /include | |
parent | 3b3478eaf8da7b83128fef0cf2cbd7b6804abe4b (diff) |
Minor cmake nitpicks (#969)
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/CMakeLists.txt | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt new file mode 100644 index 0000000..ab90344 --- /dev/null +++ b/include/CMakeLists.txt @@ -0,0 +1,20 @@ + +# 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() |