From c3a1143d23b9b868543fcfad7baab273aedddaab Mon Sep 17 00:00:00 2001 From: philsquared Date: Tue, 2 Jan 2018 10:18:35 +0000 Subject: [PATCH] Cleanly override warning level for SelfTest in MSVC Eliminates warning about warning level override (by removing the default /W3) --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 913f2b07..97a11485 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -317,7 +317,8 @@ if (NOT NO_SELFTEST) target_compile_options( SelfTest PRIVATE -Wweak-vtables -Wexit-time-destructors -Wglobal-constructors -Wmissing-noreturn ) endif() if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) - target_compile_options( SelfTest PRIVATE /W4 /w44265 /WX /w44061 /w44062 ) + STRING(REGEX REPLACE "/W[0-9]" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # override default warning level + target_compile_options( SelfTest PRIVATE /w44265 /WX /w44061 /w44062 ) endif()