From ee227d3af5c0d5abcb8816e34809df60b9665ec1 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Mon, 27 Feb 2006 10:58:20 -0500 Subject: [PATCH] ENH: Several packaging issues. Allow random variables to be passed to cpack (anything starting with CPACK_, add preinstall to the list of dependencies for package, fix typos --- Modules/CPack.Info.plist.in | 4 +-- Modules/CPack.cmake | 9 +++++ Modules/NSIS.template.in | 2 -- Source/CPack/cmCPackGenericGenerator.cxx | 2 +- Source/cmBootstrapCommands.cxx | 2 ++ Source/cmCommands.cxx | 2 -- Source/cmGlobalGenerator.cxx | 4 +++ Templates/CPackConfig.cmake.in | 42 +++++++++++++----------- 8 files changed, 41 insertions(+), 26 deletions(-) diff --git a/Modules/CPack.Info.plist.in b/Modules/CPack.Info.plist.in index 622b288f5..5ad9a37e3 100644 --- a/Modules/CPack.Info.plist.in +++ b/Modules/CPack.Info.plist.in @@ -4,9 +4,9 @@ IFMajorVersion -@CPACK_PACKAGE_MAJOR_VERSION@ +@CPACK_PACKAGE_VERSION_MAJOR@ IFMinorVersion -@CPACK_PACKAGE_MINOR_VERSION@ +@CPACK_PACKAGE_VERSION_MINOR@ IFPkgFlagAllowBackRev IFPkgFlagAuthorizationAction diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 2a80741c4..9b3689d46 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -82,4 +82,13 @@ IF(CMake_INSTALL_SYSTEM_RUNTIME_LIBS) ENDIF(WIN32) ENDIF(CMake_INSTALL_SYSTEM_RUNTIME_LIBS) +SET(_CPACK_UNUSED_VARIABLES_) +GET_CMAKE_PROPERTY(res VARIABLES) +FOREACH(var ${res}) + IF("xxx${var}" MATCHES "xxxCPACK") + SET(_CPACK_OTHER_VARIABLES_ + "${_CPACK_OTHER_VARIABLES_}\nSET(${var} \"${${var}}\")") + ENDIF("xxx${var}" MATCHES "xxxCPACK") +ENDFOREACH(var ${res}) + CONFIGURE_FILE("${cpack_input_file}" "${CMAKE_BINARY_DIR}/CPackConfig.cmake" @ONLY IMMEDIATE) diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index e84a11243..87f8c6668 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -355,7 +355,6 @@ Section "Dummy Section" SecDummy ;Create shortcuts CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" @CPACK_NSIS_CREATE_ICONS@ -@CPACK_NSIS_CREATE_EXTRA_ICONS@ CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe" @CPACK_NSIS_EXTRA_INSTALL_COMMANDS@ @@ -415,7 +414,6 @@ Section "Uninstall" Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" @CPACK_NSIS_DELETE_ICONS@ -@CPACK_NSIS_DELETE_EXTRA_ICONS@ ;Delete empty start menu parent diretories StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" diff --git a/Source/CPack/cmCPackGenericGenerator.cxx b/Source/CPack/cmCPackGenericGenerator.cxx index b203563d5..920a89e83 100644 --- a/Source/CPack/cmCPackGenericGenerator.cxx +++ b/Source/CPack/cmCPackGenericGenerator.cxx @@ -101,7 +101,7 @@ int cmCPackGenericGenerator::PrepareNames() if ( !this->GetOption("CPACK_PACKAGE_DESCRIPTION") ) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Project description not specified. Please specify CPACK_PACKAGE_DESCRIPTION or CPACK_PACKAGE_DESCRIPTION_FILE_NAME." + "Project description not specified. Please specify CPACK_PACKAGE_DESCRIPTION or CPACK_PACKAGE_DESCRIPTION_FILE." << std::endl); return 0; } diff --git a/Source/cmBootstrapCommands.cxx b/Source/cmBootstrapCommands.cxx index fe4f32d71..e20da55c6 100644 --- a/Source/cmBootstrapCommands.cxx +++ b/Source/cmBootstrapCommands.cxx @@ -44,6 +44,7 @@ #include "cmFindPathCommand.cxx" #include "cmFindProgramCommand.cxx" #include "cmForEachCommand.cxx" +#include "cmGetCMakePropertyCommand.cxx" #include "cmGetFilenameComponentCommand.cxx" #include "cmGetSourceFilePropertyCommand.cxx" #include "cmGetTargetPropertyCommand.cxx" @@ -102,6 +103,7 @@ void GetBootstrapCommands(std::list& commands) commands.push_back(new cmFindPathCommand); commands.push_back(new cmFindProgramCommand); commands.push_back(new cmForEachCommand); + commands.push_back(new cmGetCMakePropertyCommand); commands.push_back(new cmGetFilenameComponentCommand); commands.push_back(new cmGetSourceFilePropertyCommand); commands.push_back(new cmGetTargetPropertyCommand); diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index da4683ddc..63f5f4da2 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -22,7 +22,6 @@ #include "cmExportLibraryDependencies.cxx" #include "cmEnableLanguageCommand.cxx" #include "cmFLTKWrapUICommand.cxx" -#include "cmGetCMakePropertyCommand.cxx" #include "cmGetDirectoryPropertyCommand.cxx" #include "cmGetTestPropertyCommand.cxx" #include "cmIncludeExternalMSProjectCommand.cxx" @@ -66,7 +65,6 @@ void GetPredefinedCommands(std::list& commands.push_back(new cmExecuteProcessCommand); commands.push_back(new cmExportLibraryDependenciesCommand); commands.push_back(new cmFLTKWrapUICommand); - commands.push_back(new cmGetCMakePropertyCommand); commands.push_back(new cmGetDirectoryPropertyCommand); commands.push_back(new cmGetTestPropertyCommand); commands.push_back(new cmIncludeExternalMSProjectCommand); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index fe8324e4f..e783774d1 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1226,6 +1226,10 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) configFile += "/CPackConfig.cmake"; singleLine.push_back(configFile); cpackCommandLines.push_back(singleLine); + if ( this->GetPreInstallAvailable() ) + { + depends.push_back("preinstall"); + } (*targets)[this->GetPackageTargetName()] = this->CreateGlobalTarget(this->GetPackageTargetName(), "Run CPack packaging tool...", &cpackCommandLines, depends); diff --git a/Templates/CPackConfig.cmake.in b/Templates/CPackConfig.cmake.in index be52b74cd..0f4ecd0f2 100644 --- a/Templates/CPackConfig.cmake.in +++ b/Templates/CPackConfig.cmake.in @@ -1,22 +1,26 @@ -SET(CPACK_GENERATOR "@CPACK_GENERATOR@") +# This file will be configured to contain variables for CPack. These variables +# should be set in the CMake list file of the project before CPack module is +# included. Example variables are: +# CPACK_BINARY_DIR - Path to the build tree +# CPACK_GENERATOR - Generator used to create package +# CPACK_PACKAGE_DESCRIPTION_FILE - Description file for the package +# CPACK_PACKAGE_DESCRIPTION_SUMMARY - Summary of the package +# CPACK_PACKAGE_EXECUTABLES - List of pairs of executables and labels +# CPACK_PACKAGE_FILE_NAME - Name of the package generated +# CPACK_PACKAGE_ICON - Icon used for the package +# CPACK_PACKAGE_INSTALL_DIRECTORY - Name of directory for the installer +# CPACK_PACKAGE_NAME - Package project name +# CPACK_PACKAGE_VENDOR - Package project vendor +# CPACK_PACKAGE_VERSION - Package project version +# CPACK_PACKAGE_VERSION_MAJOR - Package project version (major) +# CPACK_PACKAGE_VERSION_MINOR - Package project version (minor) +# CPACK_PACKAGE_VERSION_PATCH - Package project version (patch) -SET(CPACK_PACKAGE_NAME "@CPACK_PACKAGE_NAME@") -SET(CPACK_PACKAGE_INSTALL_DIRECTORY "@CPACK_PACKAGE_INSTALL_DIRECTORY@") -SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@") -SET(CPACK_PACKAGE_VERSION_MAJOR "@CPACK_PACKAGE_VERSION_MAJOR@") -SET(CPACK_PACKAGE_VERSION_MINOR "@CPACK_PACKAGE_VERSION_MINOR@") -SET(CPACK_PACKAGE_VERSION_PATCH "@CPACK_PACKAGE_VERSION_PATCH@") +# There are certain generator specific ones -SET(CPACK_PACKAGE_VENDOR "@CPACK_PACKAGE_VENDOR@") +# NSIS Generator: +# CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Name of the registry key for the installer +# CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - Extra commands used during uninstall +# CPACK_NSIS_EXTRA_INSTALL_COMMANDS - Extra commands used during install -SET(CPACK_PACKAGE_FILE_NAME "@CPACK_PACKAGE_FILE_NAME@") - -SET(CPACK_PACKAGE_EXECUTABLES "@CPACK_PACKAGE_EXECUTABLES@") - -SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "@CPACK_PACKAGE_DESCRIPTION_SUMMARY@") -SET(CPACK_PACKAGE_DESCRIPTION_FILE "@CPACK_PACKAGE_DESCRIPTION_FILE@") - -# It is a CMake project, so we need a binary directory -SET(CPACK_BINARY_DIR "@CPACK_BINARY_DIR@") - -SET(CPACK_PACKAGE_ICON "@CPACK_PACKAGE_ICON@") +@_CPACK_OTHER_VARIABLES_@