diff options
author | Brad King <brad.king@kitware.com> | 2016-05-13 13:38:29 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-05-13 13:38:29 (GMT) |
commit | a0e00c4b3f81293e3547ed94be70504caeff2021 (patch) | |
tree | ad87e4e8a072e68d5fd214e56a3180d6efc2bf94 | |
parent | bdc84a9def0ad1110e04bca9373a80abdd9a2c66 (diff) | |
parent | 6b0b0660740e879ba90cc4a69293a46ad28c896c (diff) | |
download | CMake-a0e00c4b3f81293e3547ed94be70504caeff2021.zip CMake-a0e00c4b3f81293e3547ed94be70504caeff2021.tar.gz CMake-a0e00c4b3f81293e3547ed94be70504caeff2021.tar.bz2 |
Merge topic 'InstallRequiredSystemLibraries-Windows-UCRT'
6b0b0660 InstallRequiredSystemLibraries: Optionally install Windows UCRT (#16073)
bbf8c03b InstallRequiredSystemLibraries: Fix ENV{ProgramFiles(x86)} reference
-rw-r--r-- | Help/release/dev/InstallRequiredSystemLibraries-Windows-UCRT.rst | 6 | ||||
-rw-r--r-- | Modules/InstallRequiredSystemLibraries.cmake | 25 | ||||
-rw-r--r-- | Tests/SimpleInstall/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/SimpleInstallS2/CMakeLists.txt | 1 |
4 files changed, 32 insertions, 1 deletions
diff --git a/Help/release/dev/InstallRequiredSystemLibraries-Windows-UCRT.rst b/Help/release/dev/InstallRequiredSystemLibraries-Windows-UCRT.rst new file mode 100644 index 0000000..e52531d --- /dev/null +++ b/Help/release/dev/InstallRequiredSystemLibraries-Windows-UCRT.rst @@ -0,0 +1,6 @@ +InstallRequiredSystemLibraries-Windows-UCRT +------------------------------------------- + +* The :module:`InstallRequiredSystemLibraries` module learned a new + ``CMAKE_INSTALL_UCRT_LIBRARIES`` option to enable app-local deployment + of the Windows Universal CRT libraries with Visual Studio 2015. diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 2ff9aed..aa84077 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -23,6 +23,11 @@ # Set to TRUE to install only the debug runtime libraries with MSVC # tools even if the release runtime libraries are also available. # +# ``CMAKE_INSTALL_UCRT_LIBRARIES`` +# Set to TRUE to install the Windows Universal CRT libraries for +# app-local deployment. This is meaningful only with MSVC from +# Visual Studio 2015 or higher. +# # ``CMAKE_INSTALL_MFC_LIBRARIES`` # Set to TRUE to install the MSVC MFC runtime libraries. # @@ -171,12 +176,12 @@ if(MSVC) # Find the runtime library redistribution directory. get_filename_component(msvc_install_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\${v}.0;InstallDir]" ABSOLUTE) + set(programfilesx86 "ProgramFiles(x86)") find_path(MSVC${v}_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.CRT PATHS "${msvc_install_dir}/../../VC/redist" "${base_dir}/VC/redist" "$ENV{ProgramFiles}/Microsoft Visual Studio ${v}.0/VC/redist" - set(programfilesx86 "ProgramFiles(x86)") "$ENV{${programfilesx86}}/Microsoft Visual Studio ${v}.0/VC/redist" ) mark_as_advanced(MSVC${v}_REDIST_DIR) @@ -207,6 +212,24 @@ if(MSVC) list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/msvcr${v}0d.dll") endif() endif() + + if(CMAKE_INSTALL_UCRT_LIBRARIES AND NOT v VERSION_LESS 14) + # Find the Windows Universal CRT redistribution directory. + get_filename_component(windows_kits_dir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" ABSOLUTE) + set(programfilesx86 "ProgramFiles(x86)") + find_path(WINDOWS_KITS_REDIST_DIR NAMES ucrt/DLLs/${CMAKE_MSVC_ARCH}/ucrtbase.dll + PATHS + "${windows_kits_dir}/Redist" + "$ENV{ProgramFiles}/Windows Kits/10/Redist" + "$ENV{${programfilesx86}}/Windows Kits/10/Redist" + ) + mark_as_advanced(WINDOWS_KITS_REDIST_DIR) + + # Glob the list of UCRT DLLs. + file(GLOB __ucrt_dlls "${WINDOWS_KITS_REDIST_DIR}/ucrt/DLLs/${CMAKE_MSVC_ARCH}/*.dll") + list(APPEND __install__libs ${__ucrt_dlls}) + endif() endmacro() if(MSVC10) diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt index 2737f18..aee92f6 100644 --- a/Tests/SimpleInstall/CMakeLists.txt +++ b/Tests/SimpleInstall/CMakeLists.txt @@ -364,6 +364,7 @@ endif() set(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install") set(CMAKE_INSTALL_MFC_LIBRARIES 1) set(CMAKE_INSTALL_DEBUG_LIBRARIES 1) +set(CMAKE_INSTALL_UCRT_LIBRARIES 1) include(InstallRequiredSystemLibraries) if(CTEST_TEST_CPACK) diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt index 2737f18..aee92f6 100644 --- a/Tests/SimpleInstallS2/CMakeLists.txt +++ b/Tests/SimpleInstallS2/CMakeLists.txt @@ -364,6 +364,7 @@ endif() set(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install") set(CMAKE_INSTALL_MFC_LIBRARIES 1) set(CMAKE_INSTALL_DEBUG_LIBRARIES 1) +set(CMAKE_INSTALL_UCRT_LIBRARIES 1) include(InstallRequiredSystemLibraries) if(CTEST_TEST_CPACK) |