aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhannesweisbach <hannesweisbach@users.noreply.github.com>2018-11-29 00:37:59 +0100
committerAnna Gringauze <annagrin@microsoft.com>2018-11-28 15:37:59 -0800
commit0f68d133fa6fd2973951b8aaab481e34bbfd2cf4 (patch)
tree287304f347e4e61dcb1f13bce24e6cc8626eed14
parent88aca1caf3a6fdb4ce387d5ccb5efac47530e1b8 (diff)
downloadplatform_external_Microsoft-GSL-0f68d133fa6fd2973951b8aaab481e34bbfd2cf4.tar.gz
platform_external_Microsoft-GSL-0f68d133fa6fd2973951b8aaab481e34bbfd2cf4.tar.bz2
platform_external_Microsoft-GSL-0f68d133fa6fd2973951b8aaab481e34bbfd2cf4.zip
Suppress Warnings in GSL Headers (#731)
Suppress warnings in GSL headers using the SYSTEM keyword for target_include_directories(). This enables developers to see warnings standalone builds but hides them from users in non-standalone builds.
-rw-r--r--CMakeLists.txt20
1 files changed, 15 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b0de85d..71011b1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,11 +51,21 @@ target_compile_definitions(GSL INTERFACE
)
# add include folders to the library and targets that consume it
-target_include_directories(GSL INTERFACE
- $<BUILD_INTERFACE:
- ${CMAKE_CURRENT_SOURCE_DIR}/include
- >
-)
+# the SYSTEM keyword suppresses warnings for users of the library
+if(GSL_STANDALONE_PROJECT)
+ target_include_directories(GSL INTERFACE
+ $<BUILD_INTERFACE:
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+ >
+ )
+else()
+ target_include_directories(GSL SYSTEM INTERFACE
+ $<BUILD_INTERFACE:
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+ >
+ )
+endif()
+
if ((CMAKE_VERSION GREATER 3.7.9) OR (CMAKE_VERSION EQUAL 3.7.9))
if (MSVC_IDE)