InstallRequiredSystemLibraries: Optionally install Windows UCRT (#16073)

This commit is contained in:
Brad King 2016-05-12 11:10:23 -04:00
parent bbf8c03b4f
commit 6b0b066074
4 changed files with 31 additions and 0 deletions

View File

@ -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.

View File

@ -23,6 +23,11 @@
# Set to TRUE to install only the debug runtime libraries with MSVC # Set to TRUE to install only the debug runtime libraries with MSVC
# tools even if the release runtime libraries are also available. # 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`` # ``CMAKE_INSTALL_MFC_LIBRARIES``
# Set to TRUE to install the MSVC MFC runtime libraries. # Set to TRUE to install the MSVC MFC runtime libraries.
# #
@ -207,6 +212,24 @@ if(MSVC)
list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/msvcr${v}0d.dll") list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/msvcr${v}0d.dll")
endif() endif()
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() endmacro()
if(MSVC10) if(MSVC10)

View File

@ -364,6 +364,7 @@ endif()
set(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install") set(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install")
set(CMAKE_INSTALL_MFC_LIBRARIES 1) set(CMAKE_INSTALL_MFC_LIBRARIES 1)
set(CMAKE_INSTALL_DEBUG_LIBRARIES 1) set(CMAKE_INSTALL_DEBUG_LIBRARIES 1)
set(CMAKE_INSTALL_UCRT_LIBRARIES 1)
include(InstallRequiredSystemLibraries) include(InstallRequiredSystemLibraries)
if(CTEST_TEST_CPACK) if(CTEST_TEST_CPACK)

View File

@ -364,6 +364,7 @@ endif()
set(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install") set(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install")
set(CMAKE_INSTALL_MFC_LIBRARIES 1) set(CMAKE_INSTALL_MFC_LIBRARIES 1)
set(CMAKE_INSTALL_DEBUG_LIBRARIES 1) set(CMAKE_INSTALL_DEBUG_LIBRARIES 1)
set(CMAKE_INSTALL_UCRT_LIBRARIES 1)
include(InstallRequiredSystemLibraries) include(InstallRequiredSystemLibraries)
if(CTEST_TEST_CPACK) if(CTEST_TEST_CPACK)