Skip to content

Commit f0dd3d4

Browse files
studootmurraycu
authored andcommitted
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.
1 parent 858e3da commit f0dd3d4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ project (sigc++)
3030

3131
set( CMAKE_CXX_STANDARD 17 )
3232

33-
# Turn on warnings for MSVC
34-
if (MSVC)
35-
# Remove the CMake default of /W3 because when you add /W4, MSVC will complain
36-
# about two warning level flags
33+
# Turn on warnings for MSVC. Remove the CMake default of /W3 because when you
34+
# add /W4, MSVC will complain about two warning level flags. This default
35+
# changed at CMake 3.15 (see
36+
# https://cmake.org/cmake/help/v3.15/policy/CMP0092.html#policy:CMP0092 for
37+
# more details)
38+
if (MSVC AND CMAKE_VERSION VERSION_LESS "13.15")
3739
string(REGEX REPLACE "(^|[ \t])/W[0-9]($|[ \t])" "\\1\\2" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
3840
string(REGEX REPLACE "(^|[ \t])/W[0-9]($|[ \t])" "\\1\\2" CMAKE_CXX_FLAGS
3941
"${CMAKE_CXX_FLAGS}")
40-
elseif(CXX_COMPILER_ID)
4142
endif()
4243

4344
# Add compiler warning flags & turn warnings into errors

0 commit comments

Comments
 (0)