summaryrefslogtreecommitdiffstats
path: root/Modules/InstallRequiredSystemLibraries.cmake
diff options
context:
space:
mode:
authorArkady Shapkin <arkady.shapkin@gmail.com>2018-03-22 18:50:03 (GMT)
committerBrad King <brad.king@kitware.com>2018-04-04 17:21:16 (GMT)
commit45bf6f6246a72874c880aa3de13ba957abd50ca6 (patch)
tree5528336b8b7045041ceb211173c5699871b8e1eb /Modules/InstallRequiredSystemLibraries.cmake
parent304f493e570a177795575b5297c4b54bf1b3d2ac (diff)
downloadCMake-45bf6f6246a72874c880aa3de13ba957abd50ca6.zip
CMake-45bf6f6246a72874c880aa3de13ba957abd50ca6.tar.gz
CMake-45bf6f6246a72874c880aa3de13ba957abd50ca6.tar.bz2
Modules: Use MSVC_TOOLSET_VERSION variable to simplify logic
Diffstat (limited to 'Modules/InstallRequiredSystemLibraries.cmake')
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake105
1 files changed, 30 insertions, 75 deletions
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index 797f9e4..50e9361 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -121,9 +121,7 @@ if(MSVC)
)
endif()
- if(MSVC_VERSION EQUAL 1400)
- set(MSVC_REDIST_NAME VC80)
-
+ if(MSVC_TOOLSET_VERSION EQUAL 80)
# Find the runtime library redistribution directory.
get_filename_component(msvc_install_dir
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]" ABSOLUTE)
@@ -163,9 +161,7 @@ if(MSVC)
endif()
endif()
- if(MSVC_VERSION EQUAL 1500)
- set(MSVC_REDIST_NAME VC90)
-
+ if(MSVC_TOOLSET_VERSION EQUAL 90)
# Find the runtime library redistribution directory.
get_filename_component(msvc_install_dir
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]" ABSOLUTE)
@@ -209,34 +205,31 @@ if(MSVC)
endif()
set(MSVC_REDIST_NAME "")
- set(_MSVCRT_DLL_VERSION "")
- set(_MSVCRT_IDE_VERSION "")
+ set(_MSVC_DLL_VERSION "")
+ set(_MSVC_IDE_VERSION "")
if(MSVC_VERSION GREATER_EQUAL 2000)
message(WARNING "MSVC ${MSVC_VERSION} not yet supported.")
- elseif(MSVC_VERSION GREATER_EQUAL 1911)
- set(MSVC_REDIST_NAME VC141)
- set(_MSVCRT_DLL_VERSION 140)
- set(_MSVCRT_IDE_VERSION 15)
- elseif(MSVC_VERSION EQUAL 1910)
- set(MSVC_REDIST_NAME VC150)
- set(_MSVCRT_DLL_VERSION 140)
- set(_MSVCRT_IDE_VERSION 15)
- elseif(MSVC_VERSION EQUAL 1900)
- set(MSVC_REDIST_NAME VC140)
- set(_MSVCRT_DLL_VERSION 140)
- set(_MSVCRT_IDE_VERSION 14)
- elseif(MSVC_VERSION EQUAL 1800)
- set(MSVC_REDIST_NAME VC120)
- set(_MSVCRT_DLL_VERSION 120)
- set(_MSVCRT_IDE_VERSION 12)
- elseif(MSVC_VERSION EQUAL 1700)
- set(MSVC_REDIST_NAME VC110)
- set(_MSVCRT_DLL_VERSION 110)
- set(_MSVCRT_IDE_VERSION 11)
- elseif(MSVC_VERSION EQUAL 1600)
- set(MSVC_REDIST_NAME VC100)
- set(_MSVCRT_DLL_VERSION 100)
- set(_MSVCRT_IDE_VERSION 10)
+ elseif(MSVC_TOOLSET_VERSION)
+ set(MSVC_REDIST_NAME VC${MSVC_TOOLSET_VERSION})
+ if(MSVC_VERSION EQUAL 1910)
+ # VS2017 named this differently prior to update 3.
+ set(MSVC_REDIST_NAME VC150)
+ endif()
+
+ math(EXPR _MSVC_DLL_VERSION "${MSVC_TOOLSET_VERSION} / 10 * 10")
+
+ if(MSVC_TOOLSET_VERSION EQUAL 141)
+ set(_MSVC_IDE_VERSION 15)
+ else()
+ math(EXPR _MSVC_IDE_VERSION "${MSVC_TOOLSET_VERSION} / 10")
+ endif()
+ endif()
+
+ set(_MSVCRT_DLL_VERSION "")
+ set(_MSVCRT_IDE_VERSION "")
+ if(_MSVC_IDE_VERSION GREATER_EQUAL 10)
+ set(_MSVCRT_DLL_VERSION "${_MSVC_DLL_VERSION}")
+ set(_MSVCRT_IDE_VERSION "${_MSVC_IDE_VERSION}")
endif()
if(_MSVCRT_DLL_VERSION)
@@ -433,23 +426,9 @@ if(MSVC)
set(_MFC_DLL_VERSION "")
set(_MFC_IDE_VERSION "")
- if(MSVC_VERSION GREATER_EQUAL 2000)
- # Version not yet supported.
- elseif(MSVC_VERSION GREATER_EQUAL 1910)
- set(_MFC_DLL_VERSION 140)
- set(_MFC_IDE_VERSION 15)
- elseif(MSVC_VERSION EQUAL 1900)
- set(_MFC_DLL_VERSION 140)
- set(_MFC_IDE_VERSION 14)
- elseif(MSVC_VERSION EQUAL 1800)
- set(_MFC_DLL_VERSION 120)
- set(_MFC_IDE_VERSION 12)
- elseif(MSVC_VERSION EQUAL 1700)
- set(_MFC_DLL_VERSION 110)
- set(_MFC_IDE_VERSION 11)
- elseif(MSVC_VERSION EQUAL 1600)
- set(_MFC_DLL_VERSION 100)
- set(_MFC_IDE_VERSION 10)
+ if(_MSVC_IDE_VERSION GREATER_EQUAL 10)
+ set(_MFC_DLL_VERSION ${_MSVC_DLL_VERSION})
+ set(_MFC_IDE_VERSION ${_MSVC_IDE_VERSION})
endif()
if(_MFC_DLL_VERSION)
@@ -520,32 +499,8 @@ if(MSVC)
# MSVC 8 was the first version with OpenMP
# Furthermore, there is no debug version of this
if(CMAKE_INSTALL_OPENMP_LIBRARIES AND _IRSL_HAVE_MSVC)
- set(_MSOMP_DLL_VERSION "")
- set(_MSOMP_IDE_VERSION "")
- if(MSVC_VERSION GREATER_EQUAL 2000)
- # Version not yet supported.
- elseif(MSVC_VERSION GREATER_EQUAL 1910)
- set(_MSOMP_DLL_VERSION 140)
- set(_MSOMP_IDE_VERSION 15)
- elseif(MSVC_VERSION EQUAL 1900)
- set(_MSOMP_DLL_VERSION 140)
- set(_MSOMP_IDE_VERSION 14)
- elseif(MSVC_VERSION EQUAL 1800)
- set(_MSOMP_DLL_VERSION 120)
- set(_MSOMP_IDE_VERSION 12)
- elseif(MSVC_VERSION EQUAL 1700)
- set(_MSOMP_DLL_VERSION 110)
- set(_MSOMP_IDE_VERSION 11)
- elseif(MSVC_VERSION EQUAL 1600)
- set(_MSOMP_DLL_VERSION 100)
- set(_MSOMP_IDE_VERSION 10)
- elseif(MSVC_VERSION EQUAL 1500)
- set(_MSOMP_DLL_VERSION 90)
- set(_MSOMP_IDE_VERSION 9)
- elseif(MSVC_VERSION EQUAL 1400)
- set(_MSOMP_DLL_VERSION 80)
- set(_MSOMP_IDE_VERSION 8)
- endif()
+ set(_MSOMP_DLL_VERSION ${_MSVC_DLL_VERSION})
+ set(_MSOMP_IDE_VERSION ${_MSVC_IDE_VERSION})
if(_MSOMP_DLL_VERSION)
set(v "${_MSOMP_DLL_VERSION}")