summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-03-23 14:30:14 (GMT)
committerBrad King <brad.king@kitware.com>2017-03-23 14:30:14 (GMT)
commitd4a693a08385024175240a5543cc2a7bb7311966 (patch)
tree55e5da07c95d4c928009662da8de5f78bc6411be /Modules
parent5ed4e48128837df0539cb1570c954e2872256930 (diff)
downloadCMake-d4a693a08385024175240a5543cc2a7bb7311966.zip
CMake-d4a693a08385024175240a5543cc2a7bb7311966.tar.gz
CMake-d4a693a08385024175240a5543cc2a7bb7311966.tar.bz2
InstallRequiredSystemLibraries: Add support for VS 2017
VS 2017 (VS 15) places its redist DLLs in `Microsoft.VC150.*` directories but still uses version number `140` in the DLL names. The redist directories now have version numbers in their name, and the MSVC and MFC runtime DLLs may be in directories with different versions. Fill out our logic to handle this. For now assume we are given the `MSVC_REDIST_DIR` value as a cache entry. Unfortunately we cannot yet find the VS 2017 MSVC redist directory automatically since there is no registry entry for the VS installation. Later we will have to use `cmVSSetupHelper` for this. Issue: #16735
Diffstat (limited to 'Modules')
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake28
1 files changed, 23 insertions, 5 deletions
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index 2ff2f06..1061da0 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -166,7 +166,10 @@ if(MSVC)
endif()
endif()
- if(MSVC_VERSION EQUAL 1900 OR MSVC_VERSION EQUAL 1910)
+ if(MSVC_VERSION EQUAL 1910)
+ set(_MSVCRT_DLL_VERSION 140)
+ set(_MSVCRT_IDE_VERSION 15)
+ elseif(MSVC_VERSION EQUAL 1900)
set(_MSVCRT_DLL_VERSION 140)
set(_MSVCRT_IDE_VERSION 14)
elseif(MSVC_VERSION EQUAL 1800)
@@ -191,7 +194,7 @@ if(MSVC)
get_filename_component(msvc_install_dir
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\${vs}.0;InstallDir]" ABSOLUTE)
set(programfilesx86 "ProgramFiles(x86)")
- if(DEFINED MSVC${vs}_REDIST_DIR AND EXISTS "${MSVC${vs}_REDIST_DIR}")
+ if(vs VERSION_LESS 15 AND DEFINED MSVC${vs}_REDIST_DIR AND EXISTS "${MSVC${vs}_REDIST_DIR}")
set(MSVC_REDIST_DIR "${MSVC${vs}_REDIST_DIR}") # use old cache entry
endif()
find_path(MSVC_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC${vs}0.CRT
@@ -362,7 +365,10 @@ if(MSVC)
)
endif()
- if(MSVC_VERSION EQUAL 1900 OR MSVC_VERSION EQUAL 1910)
+ if(MSVC_VERSION 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)
@@ -383,7 +389,16 @@ if(MSVC)
set(v "${_MFC_DLL_VERSION}")
set(vs "${_MFC_IDE_VERSION}")
- set(MSVC_REDIST_MFC_DIR "${MSVC_REDIST_DIR}")
+ # Starting with VS 15 the MFC DLLs may be in a different directory.
+ if (NOT vs VERSION_LESS 15)
+ file(GLOB _MSVC_REDIST_DIRS "${MSVC_REDIST_DIR}/../*")
+ find_path(MSVC_REDIST_MFC_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC${vs}0.MFC
+ PATHS ${_MSVC_REDIST_DIRS} NO_DEFAULT_PATH)
+ mark_as_advanced(MSVC_REDIST_MFC_DIR)
+ unset(_MSVC_REDIST_DIRS)
+ else()
+ set(MSVC_REDIST_MFC_DIR "${MSVC_REDIST_DIR}")
+ endif()
# Multi-Byte Character Set versions of MFC are available as optional
# addon since Visual Studio 12. So for version 12 or higher, check
@@ -438,7 +453,10 @@ if(MSVC)
# MSVC 8 was the first version with OpenMP
# Furthermore, there is no debug version of this
if(CMAKE_INSTALL_OPENMP_LIBRARIES)
- if(MSVC_VERSION EQUAL 1900 OR MSVC_VERSION EQUAL 1910)
+ if(MSVC_VERSION 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)