use CMake InstallRequiredSystemLibraries for MSVC

This commit is contained in:
Stephen Birarda 2016-01-22 15:27:30 -08:00
parent 921d4dccd7
commit da1902ac72
4 changed files with 5 additions and 39 deletions

View file

@ -25,6 +25,11 @@ macro(GENERATE_INSTALLERS)
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${_DISPLAY_NAME})
if (WIN32)
# include CMake module that will install compiler system libraries
# so that we have msvcr120 and msvcp120 installed with targets
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION ${INTERFACE_INSTALL_DIR})
include(InstallRequiredSystemLibraries)
set(CPACK_NSIS_MUI_ICON "${HF_CMAKE_DIR}/installer/installer.ico")
# install and reference the Add/Remove icon

View file

@ -70,6 +70,5 @@ macro(install_beside_console)
set(TARGET_INSTALL_DIR ${COMPONENT_INSTALL_DIR})
set(TARGET_INSTALL_COMPONENT ${SERVER_COMPONENT})
manually_install_ssl_eay()
manually_install_msvc()
endmacro()

View file

@ -1,37 +0,0 @@
#
# ManuallyInstallMSVC.cmake
# cmake/macros
#
# Copyright 2016 High Fidelity, Inc.
# Created by Stephen Birarda on January 22nd, 2016
#
# Distributed under the Apache License, Version 2.0.
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
#
# On windows fixup_bundle does not find msvcr120.dll and msvcp120.dll that our targets need to be re-distributable.
# We use this macro to find them and manually install them beside the targets
macro(manually_install_msvc)
if (WIN32)
# look for the msvcr DLLs required by this target
find_path(MSVC_DLL_PATH msvcr120.dll PATHS "C:/Windows/System32" NO_DEFAULT_PATH)
if (MSVC_DLL_PATH-NOTFOUND)
# we didn't get the path to the DLLs - on production or PR build this is a fail
if (PRODUCTION_BUILD OR PR_BUILD)
message(FATAL_ERROR "Did not find MSVC_DLL_PATH for msvcr120.dll and msvcp120.dll.\
Both are required to package re-distributable installer."
)
endif ()
else ()
# manually install the two DLLs for this component
install(
FILES "${MSVC_DLL_PATH}/msvcr120.dll" "${MSVC_DLL_PATH}/msvcp120.dll"
DESTINATION ${TARGET_INSTALL_DIR}
COMPONENT ${TARGET_INSTALL_COMPONENT}
)
endif ()
endif ()
endmacro()

View file

@ -267,7 +267,6 @@ if (WIN32)
set(TARGET_INSTALL_DIR ${INTERFACE_INSTALL_DIR})
set(TARGET_INSTALL_COMPONENT ${CLIENT_COMPONENT})
manually_install_ssl_eay()
manually_install_msvc()
package_libraries_for_deployment()
endif()