Merge topic 'fix-install-req-sys-libs'

96cd163 Add CPACK_NSIS_INSTALL_ROOT for CMake's own installer (#9148)
fa4a3b0 Add CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS variable
fc14492 VS10: Fix problems with InstallRequiredSystemLibraries.
This commit is contained in:
Brad King 2011-01-19 14:03:15 -05:00 committed by CMake Topic Stage
commit d0b4f13521
3 changed files with 82 additions and 37 deletions

View File

@ -13,16 +13,18 @@
# If the cmake version includes cpack, use it
IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
IF(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
OPTION(CMAKE_INSTALL_DEBUG_LIBRARIES
OPTION(CMAKE_INSTALL_DEBUG_LIBRARIES
"Install Microsoft runtime debug libraries with CMake." FALSE)
MARK_AS_ADVANCED(CMAKE_INSTALL_DEBUG_LIBRARIES)
# By default, do not warn when built on machines using only VS Express:
IF(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
ENDIF()
INCLUDE(${CMake_SOURCE_DIR}/Modules/InstallRequiredSystemLibraries.cmake)
ENDIF(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
# Set the options file that needs to be included inside CMakeCPackOptions.cmake
SET(QT_DIALOG_CPACK_OPTIONS_FILE ${CMake_BINARY_DIR}/Source/QtDialog/QtDialogCPack.cmake)
CONFIGURE_FILE("${CMake_SOURCE_DIR}/CMakeCPackOptions.cmake.in"
"${CMake_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY)
SET(CPACK_PROJECT_CONFIG_FILE "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMake is a build tool")
SET(CPACK_PACKAGE_VENDOR "Kitware")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
@ -30,6 +32,25 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
SET(CPACK_PACKAGE_VERSION "${CMake_VERSION}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "cmake-${CMake_VERSION}")
# Make this explicit here, rather than accepting the CPack default value,
# so we can refer to it:
SET(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
# Installers for 32- vs. 64-bit CMake:
# - Root install directory (displayed to end user at installer-run time)
# - "NSIS package/display name" (text used in the installer GUI)
# - Registry key used to store info about the installation
IF(CMAKE_CL_64)
SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
SET(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} (Win64)")
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION} (Win64)")
ELSE()
SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
SET(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
ENDIF()
IF(NOT DEFINED CPACK_SYSTEM_NAME)
# make sure package is not Cygwin-unknown, for Cygwin just
# cygwin is good for the system name
@ -41,11 +62,12 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
ENDIF(NOT DEFINED CPACK_SYSTEM_NAME)
IF(${CPACK_SYSTEM_NAME} MATCHES Windows)
IF(CMAKE_CL_64)
SET(CPACK_SYSTEM_NAME win64-${CMAKE_SYSTEM_PROCESSOR})
SET(CPACK_SYSTEM_NAME win64-x64)
ELSE(CMAKE_CL_64)
SET(CPACK_SYSTEM_NAME win32-${CMAKE_SYSTEM_PROCESSOR})
SET(CPACK_SYSTEM_NAME win32-x86)
ENDIF(CMAKE_CL_64)
ENDIF(${CPACK_SYSTEM_NAME} MATCHES Windows)
IF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
# if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
# default to source package - system, on cygwin system is not
@ -57,15 +79,17 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
"${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
ENDIF(CYGWIN)
ENDIF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
SET(CPACK_PACKAGE_CONTACT "cmake@cmake.org")
IF(UNIX)
SET(CPACK_STRIP_FILES "bin/ccmake;bin/cmake;bin/cpack;bin/ctest")
SET(CPACK_SOURCE_STRIP_FILES "")
SET(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake")
ENDIF(UNIX)
# cygwin specific packaging stuff
# cygwin specific packaging stuff
IF(CYGWIN)
# setup the cygwin package name
SET(CPACK_PACKAGE_NAME cmake)
# setup the name of the package for cygwin cmake-2.4.3
@ -87,6 +111,13 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
# this file uses some of the package file name variables
INCLUDE(Utilities/Release/Cygwin/CMakeLists.txt)
ENDIF(CYGWIN)
# Set the options file that needs to be included inside CMakeCPackOptions.cmake
SET(QT_DIALOG_CPACK_OPTIONS_FILE ${CMake_BINARY_DIR}/Source/QtDialog/QtDialogCPack.cmake)
CONFIGURE_FILE("${CMake_SOURCE_DIR}/CMakeCPackOptions.cmake.in"
"${CMake_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY)
SET(CPACK_PROJECT_CONFIG_FILE "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake")
# include CPack model once all variables are set
INCLUDE(CPack)
ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")

View File

@ -3,8 +3,10 @@
# in this file.
if(CPACK_GENERATOR MATCHES "NSIS")
SET(CPACK_NSIS_INSTALL_ROOT "@CPACK_NSIS_INSTALL_ROOT@")
# set the install/unistall icon used for the installer itself
# There is a bug in NSI that does not handle full unix paths properly.
# There is a bug in NSI that does not handle full unix paths properly.
SET(CPACK_NSIS_MUI_ICON "@CMake_SOURCE_DIR@/Utilities/Release\\CMakeLogo.ico")
SET(CPACK_NSIS_MUI_UNIICON "@CMake_SOURCE_DIR@/Utilities/Release\\CMakeLogo.ico")
# set the package header icon for MUI
@ -21,11 +23,11 @@ if(CPACK_GENERATOR MATCHES "NSIS")
"doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cpack.html" "CPack Help"
"http://www.cmake.org" "CMake Web Site"
)
# Use the icond from cmake-gui for add-remove programs
# Use the icon from cmake-gui for add-remove programs
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\cmake-gui.exe")
SET(CPACK_NSIS_DISPLAY_NAME "CMake @CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@ a cross-platform, open-source build system")
SET(CPACK_NSIS_PACKAGE_NAME "CMake @CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@")
SET(CPACK_NSIS_PACKAGE_NAME "@CPACK_NSIS_PACKAGE_NAME@")
SET(CPACK_NSIS_DISPLAY_NAME "@CPACK_NSIS_PACKAGE_NAME@, a cross-platform, open-source build system")
SET(CPACK_NSIS_HELP_LINK "http://www.cmake.org")
SET(CPACK_NSIS_URL_INFO_ABOUT "http://www.kitware.com")
SET(CPACK_NSIS_CONTACT @CPACK_PACKAGE_CONTACT@)

View File

@ -16,6 +16,12 @@
# libraries are installed as well as the CRT run time libraries.
# If CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION is set then the libraries are
# installed to that directory rather than the default.
# If CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS is NOT set, then this file
# warns about required files that do not exist. You can set this variable to
# ON before including this file to avoid the warning. For example, the Visual
# Studio Express editions do not include the redistributable files, so if you
# include this file on a machine with only VS Express installed, you'll get
# the warning.
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@ -33,6 +39,21 @@
IF(MSVC)
FILE(TO_CMAKE_PATH "$ENV{SYSTEMROOT}" SYSTEMROOT)
IF(CMAKE_CL_64)
IF(MSVC_VERSION GREATER 1599)
# VS 10 and later:
SET(CMAKE_MSVC_ARCH x64)
ELSE()
# VS 9 and earlier:
SET(CMAKE_MSVC_ARCH amd64)
ENDIF()
ELSE(CMAKE_CL_64)
SET(CMAKE_MSVC_ARCH x86)
ENDIF(CMAKE_CL_64)
GET_FILENAME_COMPONENT(devenv_dir "${CMAKE_MAKE_PROGRAM}" PATH)
GET_FILENAME_COMPONENT(base_dir "${devenv_dir}/../.." ABSOLUTE)
IF(MSVC70)
SET(__install__libs
"${SYSTEMROOT}/system32/msvcp70.dll"
@ -47,15 +68,6 @@ IF(MSVC)
)
ENDIF(MSVC71)
IF(CMAKE_CL_64)
SET(CMAKE_MSVC_ARCH amd64)
ELSE(CMAKE_CL_64)
SET(CMAKE_MSVC_ARCH x86)
ENDIF(CMAKE_CL_64)
GET_FILENAME_COMPONENT(devenv_dir "${CMAKE_MAKE_PROGRAM}" PATH)
GET_FILENAME_COMPONENT(base_dir "${devenv_dir}/../.." ABSOLUTE)
IF(MSVC80)
# Find the runtime library redistribution directory.
FIND_PATH(MSVC80_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest
@ -87,7 +99,6 @@ IF(MSVC)
"${MSVC80_CRT_DIR}/msvcr80d.dll"
)
ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES)
ENDIF(MSVC80)
IF(MSVC90)
@ -130,15 +141,14 @@ IF(MSVC)
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]/../../VC/redist"
"${base_dir}/VC/redist"
"$ENV{ProgramFiles}/Microsoft Visual Studio 10.0/VC/redist"
"$ENV{ProgramFiles(x86)}/Microsoft Visual Studio 10.0/VC/redist"
)
MARK_AS_ADVANCED(MSVC10_REDIST_DIR)
SET(MSVC10_CRT_DIR "${MSVC10_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC100.CRT")
# Install the manifest that allows DLLs to be loaded from the
# directory containing the executable.
IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
SET(__install__libs
"${MSVC10_CRT_DIR}/Microsoft.VC100.CRT.manifest"
"${MSVC10_CRT_DIR}/msvcp100.dll"
"${MSVC10_CRT_DIR}/msvcr100.dll"
)
@ -146,9 +156,8 @@ IF(MSVC)
IF(CMAKE_INSTALL_DEBUG_LIBRARIES)
SET(MSVC10_CRT_DIR
"${MSVC10_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugCRT")
"${MSVC10_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC100.DebugCRT")
SET(__install__libs ${__install__libs}
"${MSVC10_CRT_DIR}/Microsoft.VC100.DebugCRT.manifest"
"${MSVC10_CRT_DIR}/msvcp100d.dll"
"${MSVC10_CRT_DIR}/msvcr100d.dll"
)
@ -161,11 +170,13 @@ IF(MSVC)
"${SYSTEMROOT}/system32/mfc70.dll"
)
ENDIF(MSVC70)
IF(MSVC71)
SET(__install__libs ${__install__libs}
"${SYSTEMROOT}/system32/mfc71.dll"
)
ENDIF(MSVC71)
IF(MSVC80)
IF(CMAKE_INSTALL_DEBUG_LIBRARIES)
SET(MSVC80_MFC_DIR
@ -259,7 +270,6 @@ IF(MSVC)
SET(MSVC10_MFC_DIR
"${MSVC10_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC100.DebugMFC")
SET(__install__libs ${__install__libs}
"${MSVC10_MFC_DIR}/Microsoft.VC100.DebugMFC.manifest"
"${MSVC10_MFC_DIR}/mfc100d.dll"
"${MSVC10_MFC_DIR}/mfc100ud.dll"
"${MSVC10_MFC_DIR}/mfcm100d.dll"
@ -268,11 +278,8 @@ IF(MSVC)
ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES)
SET(MSVC10_MFC_DIR "${MSVC10_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC100.MFC")
# Install the manifest that allows DLLs to be loaded from the
# directory containing the executable.
IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
SET(__install__libs ${__install__libs}
"${MSVC10_MFC_DIR}/Microsoft.VC100.MFC.manifest"
"${MSVC10_MFC_DIR}/mfc100.dll"
"${MSVC10_MFC_DIR}/mfc100u.dll"
"${MSVC10_MFC_DIR}/mfcm100.dll"
@ -282,10 +289,7 @@ IF(MSVC)
# include the language dll's for vs10 as well as the actuall dll's
SET(MSVC10_MFCLOC_DIR "${MSVC10_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC100.MFCLOC")
# Install the manifest that allows DLLs to be loaded from the
# directory containing the executable.
SET(__install__libs ${__install__libs}
"${MSVC10_MFCLOC_DIR}/Microsoft.VC100.MFCLOC.manifest"
"${MSVC10_MFCLOC_DIR}/mfc100chs.dll"
"${MSVC10_MFCLOC_DIR}/mfc100cht.dll"
"${MSVC10_MFCLOC_DIR}/mfc100enu.dll"
@ -297,7 +301,6 @@ IF(MSVC)
"${MSVC10_MFCLOC_DIR}/mfc100kor.dll"
)
ENDIF(MSVC10)
ENDIF(CMAKE_INSTALL_MFC_LIBRARIES)
FOREACH(lib
@ -306,6 +309,15 @@ IF(MSVC)
IF(EXISTS ${lib})
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib})
ELSE(EXISTS ${lib})
IF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
MESSAGE(WARNING "system runtime library file does not exist: '${lib}'")
# This warning indicates an incomplete Visual Studio installation
# or a bug somewhere above here in this file.
# If you would like to avoid this warning, fix the real problem, or
# set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS before including
# this file.
ENDIF()
ENDIF(EXISTS ${lib})
ENDFOREACH(lib)
ENDIF(MSVC)