Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/miloyip/rapidjson.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilo Yip <miloyip@gmail.com>2016-03-31 09:20:24 +0300
committerMilo Yip <miloyip@gmail.com>2016-03-31 09:20:24 +0300
commitd7df1f26ba56922aed0bcdb2b39cf46bd78e36c6 (patch)
tree569b75d1a06b68b5157ed9fb5508a2433e91cc1d
parent89afda0694c922afe66cde29e6ac40044bb2978c (diff)
Add /W4 and /WX for VC
-rw-r--r--test/unittest/CMakeLists.txt22
1 files changed, 18 insertions, 4 deletions
diff --git a/test/unittest/CMakeLists.txt b/test/unittest/CMakeLists.txt
index 3f76a4f3..ff49bb94 100644
--- a/test/unittest/CMakeLists.txt
+++ b/test/unittest/CMakeLists.txt
@@ -38,12 +38,26 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswitch-default -Wfloat-equal")
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswitch-default -Wfloat-equal -Wimplicit-fallthrough -Weverything")
- # If the user is running a newer version of Clang that includes the
- # -Wdouble-promotion, we will ignore that warning.
- if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.7)
+ # If the user is running a newer version of Clang that includes the
+ # -Wdouble-promotion, we will ignore that warning.
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.7)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-double-promotion")
- endif()
+ endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
+ # Force to always compile with /W4
+ if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
+ string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ else()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
+ endif()
+
+ # Force to always compile with /WX
+ if(CMAKE_CXX_FLAGS MATCHES "/WX-")
+ string(REGEX REPLACE "/WX-" "/WX" CMAKE_CXX_FLAGS
+ else()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
+ endif()
+
add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
endif()