summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Windows-MSVC.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-11-15 19:44:02 (GMT)
committerBrad King <brad.king@kitware.com>2017-11-15 19:58:44 (GMT)
commit3bc21a70b5c026d2dfe400ea3180f33bbaf529ea (patch)
treec7124f457c8fa4a5f49dd66d6bcece67f0af92c0 /Modules/Platform/Windows-MSVC.cmake
parent1fe9e49bad0ad4f540ceda028106d9af89084946 (diff)
downloadCMake-3bc21a70b5c026d2dfe400ea3180f33bbaf529ea.zip
CMake-3bc21a70b5c026d2dfe400ea3180f33bbaf529ea.tar.gz
CMake-3bc21a70b5c026d2dfe400ea3180f33bbaf529ea.tar.bz2
MSVC: Fix MSVC_VERSION when mixing MSVC C/C++ with Intel Fortran
When using a real MSVC compiler for `C` or `CXX`, use the version of that compiler for `MSVC_VERSION`. This is preferred over the MSVC version that a non-MSVC compiler "simulates". Fixes: #17468
Diffstat (limited to 'Modules/Platform/Windows-MSVC.cmake')
-rw-r--r--Modules/Platform/Windows-MSVC.cmake6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 4719563..0737c12 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -48,7 +48,11 @@ else()
endif()
if(NOT MSVC_VERSION)
- if(CMAKE_C_SIMULATE_VERSION)
+ if("x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC")
+ set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
+ elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
+ set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
+ elseif(CMAKE_C_SIMULATE_VERSION)
set(_compiler_version ${CMAKE_C_SIMULATE_VERSION})
elseif(CMAKE_CXX_SIMULATE_VERSION)
set(_compiler_version ${CMAKE_CXX_SIMULATE_VERSION})