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(-) (limited to 'CMakeLists.txt') 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 From be3c3c27319e95b6c60abbe40f80cb96a695abc1 Mon Sep 17 00:00:00 2001 From: k-brac Date: Tue, 15 Jan 2019 01:43:17 +0100 Subject: Fixes CMAKE_VERSION check (#759) * Fixes CMAKE_VERSION check Fixes #758 by using the correct comparison operator for a version See documentation at https://cmake.org/cmake/help/latest/command/if.html Thanks to this change, gsl natvis is properly included in a visual studio solution * cmake version check for cmake < 3.7 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 71011b1..0348f79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,7 @@ else() endif() -if ((CMAKE_VERSION GREATER 3.7.9) OR (CMAKE_VERSION EQUAL 3.7.9)) +if (CMAKE_VERSION VERSION_GREATER 3.7.8) if (MSVC_IDE) option(VS_ADD_NATIVE_VISUALIZERS "Configure project to use Visual Studio native visualizers" TRUE) else() -- cgit v1.2.3