summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Dootson <stuart.dootson@gmail.com>2019-10-24 10:11:34 +0100
committerMurray Cumming <murrayc@murrayc.com>2019-10-25 12:57:31 +0200
commitf0dd3d4523ac87dc2858e585e4f7d3f4603cd97d (patch)
tree7e37a2cfea8f8d0ecd64b31b70f78e81e8db3f93
parent858e3daca271162ae1e77fff23693de9f7a0422d (diff)
downloadsigc++-f0dd3d4523ac87dc2858e585e4f7d3f4603cd97d.tar.gz
MSVC build: Add version check to MSVC warning removal
CMake 3.15 removes /W3 as a default flag for MSVC, so we no longer need to remove it.
-rw-r--r--CMakeLists.txt11
1 files changed, 6 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 473d257..2e7f383 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,14 +30,15 @@ project (sigc++)
set( CMAKE_CXX_STANDARD 17 )
-# Turn on warnings for MSVC
-if (MSVC)
- # Remove the CMake default of /W3 because when you add /W4, MSVC will complain
- # about two warning level flags
+# Turn on warnings for MSVC. Remove the CMake default of /W3 because when you
+# add /W4, MSVC will complain about two warning level flags. This default
+# changed at CMake 3.15 (see
+# https://cmake.org/cmake/help/v3.15/policy/CMP0092.html#policy:CMP0092 for
+# more details)
+ if (MSVC AND CMAKE_VERSION VERSION_LESS "13.15")
string(REGEX REPLACE "(^|[ \t])/W[0-9]($|[ \t])" "\\1\\2" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REGEX REPLACE "(^|[ \t])/W[0-9]($|[ \t])" "\\1\\2" CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS}")
-elseif(CXX_COMPILER_ID)
endif()
# Add compiler warning flags & turn warnings into errors