summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Windows-MSVC.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/Platform/Windows-MSVC.cmake')
-rw-r--r--Modules/Platform/Windows-MSVC.cmake18
1 files changed, 14 insertions, 4 deletions
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index bd08718..3f65475 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -163,6 +163,14 @@ foreach(lang C CXX)
endif()
endforeach()
+cmake_policy(GET CMP0117 __WINDOWS_MSVC_CMP0117)
+if(__WINDOWS_MSVC_CMP0117 STREQUAL "NEW")
+ set(_GR "")
+else()
+ set(_GR " /GR")
+endif()
+unset(__WINDOWS_MSVC_CMP0117)
+
if(WINCE)
foreach(lang C CXX)
string(TOUPPER "${_MSVC_${lang}_ARCHITECTURE_FAMILY}" _MSVC_${lang}_ARCHITECTURE_FAMILY_UPPER)
@@ -182,7 +190,7 @@ if(WINCE)
set(_RTC1 "")
set(_FLAGS_C "")
- set(_FLAGS_CXX " /GR /EHsc")
+ set(_FLAGS_CXX "${_GR} /EHsc")
foreach(lang C CXX)
if(_MSVC_${lang}_ARCHITECTURE_FAMILY STREQUAL "ARM")
@@ -204,7 +212,7 @@ if(WINCE)
elseif(WINDOWS_PHONE OR WINDOWS_STORE)
set(_PLATFORM_DEFINES "/DWIN32")
set(_FLAGS_C " /DUNICODE /D_UNICODE")
- set(_FLAGS_CXX " /DUNICODE /D_UNICODE /GR /EHsc")
+ set(_FLAGS_CXX " /DUNICODE /D_UNICODE${_GR} /EHsc")
if(WINDOWS_STORE AND MSVC_VERSION GREATER 1899)
set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsApp.lib")
elseif(WINDOWS_PHONE)
@@ -226,12 +234,12 @@ else()
set(_FLAGS_CXX " -frtti -fexceptions")
else()
set(_RTC1 "/RTC1")
- set(_FLAGS_CXX " /GR /EHsc")
+ set(_FLAGS_CXX "${_GR} /EHsc")
endif()
set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
else()
set(_RTC1 "/GZ")
- set(_FLAGS_CXX " /GR /GX")
+ set(_FLAGS_CXX "${_GR} /GX")
set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib")
endif()
@@ -241,6 +249,8 @@ else()
endif()
endif()
+unset(_GR)
+
set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
# executable linker flags