summaryrefslogtreecommitdiff
path: root/Modules/Platform
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-11-15 14:44:02 -0500
committerBrad King <brad.king@kitware.com>2017-11-15 14:58:44 -0500
commit3bc21a70b5c026d2dfe400ea3180f33bbaf529ea (patch)
treec7124f457c8fa4a5f49dd66d6bcece67f0af92c0 /Modules/Platform
parent1fe9e49bad0ad4f540ceda028106d9af89084946 (diff)
downloadcmake-3bc21a70b5c026d2dfe400ea3180f33bbaf529ea.tar.gz
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')
-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 4719563cc5..0737c1269b 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})