From 0f68d133fa6fd2973951b8aaab481e34bbfd2cf4 Mon Sep 17 00:00:00 2001 From: hannesweisbach Date: Thu, 29 Nov 2018 00:37:59 +0100 Subject: 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. --- CMakeLists.txt | 20 +++++++++++++++----- 1 file 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 - $ -) +# the SYSTEM keyword suppresses warnings for users of the library +if(GSL_STANDALONE_PROJECT) + target_include_directories(GSL INTERFACE + $ + ) +else() + target_include_directories(GSL SYSTEM INTERFACE + $ + ) +endif() + if ((CMAKE_VERSION GREATER 3.7.9) OR (CMAKE_VERSION EQUAL 3.7.9)) if (MSVC_IDE) -- cgit v1.2.3