summaryrefslogtreecommitdiff
path: root/CompileFlags.cmake
diff options
context:
space:
mode:
authorZsolt Parragi <zsolt.parragi@cancellar.hu>2019-05-29 18:03:34 +0200
committerZsolt Parragi <zsolt.parragi@cancellar.hu>2019-05-29 18:18:09 +0200
commit4fe34b2d29ca67ea91b2545b223dad8abbcad282 (patch)
tree34d99fca6f3ad23737d073c086bc3e702d8176a3 /CompileFlags.cmake
parent067a4f484b1e2f650918d90051653b5c434c77a2 (diff)
downloadcmake-4fe34b2d29ca67ea91b2545b223dad8abbcad282.tar.gz
Fixing warnings generated by clang 8.0 on Windows
* Deprecation removals previously specific to MSVC/Intel now also used by clang * String literals were assigned to non const pointers. These are stored in mutable arrays now * An implicit function pointer to pointer conversion is a Microsoft extension warning is suppressed by an explicit reinterpret_cast * The MSVC specific deprecation macro for jsoncpp was moved after the clang macro to avoid redefinition warnings. This is consistent with how jsoncpp fixed the issue in 36d8cfd7
Diffstat (limited to 'CompileFlags.cmake')
-rw-r--r--CompileFlags.cmake11
1 files changed, 7 insertions, 4 deletions
diff --git a/CompileFlags.cmake b/CompileFlags.cmake
index c231ede5a5..91f2adffe1 100644
--- a/CompileFlags.cmake
+++ b/CompileFlags.cmake
@@ -8,11 +8,16 @@ if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Intel")
set(_INTEL_WINDOWS 1)
endif()
+if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Clang"
+ AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+ set(_CLANG_MSVC_WINDOWS 1)
+endif()
+
# Disable deprecation warnings for standard C functions.
# really only needed for newer versions of VS, but should
# not hurt other versions, and this will work into the
# future
-if(MSVC OR _INTEL_WINDOWS)
+if(MSVC OR _INTEL_WINDOWS OR _CLANG_MSVC_WINDOWS)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
else()
endif()
@@ -21,9 +26,7 @@ if(MSVC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stack:10000000")
endif()
-if(CMAKE_CXX_COMPILER_ID STREQUAL Clang
- AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"
- AND "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
+if(_CLANG_MSVC_WINDOWS AND "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Xlinker -stack:20000000")
endif()