From 3bc21a70b5c026d2dfe400ea3180f33bbaf529ea Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 15 Nov 2017 14:44:02 -0500 Subject: 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 --- Modules/Platform/Windows-MSVC.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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}) -- cgit v0.12