aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2014-11-24 21:59:30 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2014-11-24 21:59:30 +0100
commit7e1d399584fd2eb0c8e6f49c473ff6b1a2a7ecf6 (patch)
treef363def81973d061ea5d3600505ad7b43334f3e8
parent7a4cd7ed0f07d8c41408da02b2367c979d4ff86e (diff)
Fix MSVC options
Also disable some warnings.
-rw-r--r--api_test/CMakeLists.txt17
-rw-r--r--src/CMakeLists.txt3
2 files changed, 13 insertions, 7 deletions
diff --git a/api_test/CMakeLists.txt b/api_test/CMakeLists.txt
index b2ab2c8..c25b6c1 100644
--- a/api_test/CMakeLists.txt
+++ b/api_test/CMakeLists.txt
@@ -10,10 +10,15 @@ include_directories(
target_link_libraries(api_test libcmark)
# Compiler flags
-if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
- set_target_properties(api_test PROPERTIES COMPILE_FLAGS
- "-std=c99 -Wall -Wextra"
- )
-elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
- set_target_properties(api_test PROPERTIES COMPILE_FLAGS "/TP /W4")
+if(MSVC)
+ # Force to always compile with W4
+ if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
+ string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+ else()
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
+ endif()
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4127 /wd4244 /wd4267 /wd4706 /wd4800 /D_CRT_SECURE_NO_WARNINGS")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /TP")
+elseif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=c99 -pedantic")
endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 71f45a7..f71f09c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -121,13 +121,14 @@ if(MSVC)
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
endif()
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4127 /wd4244 /wd4267 /wd4706 /wd4800 /D_CRT_SECURE_NO_WARNINGS")
elseif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=c99 -pedantic")
endif()
# Compile as C++ under MSVC
if(MSVC)
- set(CMAKE_C_FLAGS "/TP")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /TP")
endif()
if($ENV{TIMER})