From e65c40f94a15f5e70695bd5c08444fc42262940c Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 31 Oct 2007 12:55:04 -0400 Subject: [PATCH] ENH: add CPACK_PROJECT_CONFIG_FILE option to CPack --- CMakeCPack.cmake | 3 +++ CPackConfig.cmake.in => CMakeCPackOptions.cmake.in | 9 ++++++--- CPackSourceConfig.cmake.in | 8 -------- Source/CPack/cmCPackGenericGenerator.cxx | 10 +++++++++- 4 files changed, 18 insertions(+), 12 deletions(-) rename CPackConfig.cmake.in => CMakeCPackOptions.cmake.in (87%) delete mode 100644 CPackSourceConfig.cmake.in diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index b988d178a..f511895d3 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -4,6 +4,9 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") SET(CMAKE_INSTALL_MFC_LIBRARIES 1) INCLUDE(InstallRequiredSystemLibraries) ENDIF(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.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") diff --git a/CPackConfig.cmake.in b/CMakeCPackOptions.cmake.in similarity index 87% rename from CPackConfig.cmake.in rename to CMakeCPackOptions.cmake.in index 6c92d0c12..f1be2e87e 100644 --- a/CPackConfig.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -1,6 +1,3 @@ -# all CPACK_ variables from the cmake project -@_CPACK_OTHER_VARIABLES_@ - if(CPACK_GENERATOR MATCHES "NSIS") # set the install/unistall icon used for the installer itself # There is a bug in NSI that does not handle full unix paths properly. @@ -31,3 +28,9 @@ if(CPACK_GENERATOR MATCHES "NSIS") SET(CPACK_NSIS_CONTACT @CPACK_PACKAGE_CONTACT@) SET(CPACK_NSIS_MODIFY_PATH ON) endif(CPACK_GENERATOR MATCHES "NSIS") + +if(CPACK_GENERATOR MATCHES "CygwinSource") + # when packaging source make sure the .build directory is not included + SET(CPACK_SOURCE_IGNORE_FILES + "/CVS/" "/\\.build/" "/\\.svn/" "\\.swp$" "\\.#" "/#" "~$") +endif(CPACK_GENERATOR MATCHES "CygwinSource") diff --git a/CPackSourceConfig.cmake.in b/CPackSourceConfig.cmake.in deleted file mode 100644 index 46b8eee7d..000000000 --- a/CPackSourceConfig.cmake.in +++ /dev/null @@ -1,8 +0,0 @@ -# All CPACK_ variables from the cmake project -@_CPACK_OTHER_VARIABLES_@ - -if(CPACK_GENERATOR MATCHES "CygwinSource") - # when packaging source make sure the .build directory is not included - SET(CPACK_SOURCE_IGNORE_FILES - "/CVS/" "/\\.build/" "/\\.svn/" "\\.swp$" "\\.#" "/#" "~$") -endif(CPACK_GENERATOR MATCHES "CygwinSource") diff --git a/Source/CPack/cmCPackGenericGenerator.cxx b/Source/CPack/cmCPackGenericGenerator.cxx index e961357f5..51d101839 100644 --- a/Source/CPack/cmCPackGenericGenerator.cxx +++ b/Source/CPack/cmCPackGenericGenerator.cxx @@ -60,7 +60,6 @@ void cmCPackGenericGenerator::DisplayVerboseOutput(const char* msg, //---------------------------------------------------------------------- int cmCPackGenericGenerator::PrepareNames() { - this->SetOption("CPACK_GENERATOR", this->Name.c_str()); std::string tempDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY"); tempDirectory += "/_CPack_Packages/"; @@ -754,6 +753,15 @@ int cmCPackGenericGenerator::Initialize(const char* name, cmMakefile* mf, "Cannot initialize the generator" << std::endl); return 0; } + // set the running generator name + this->SetOption("CPACK_GENERATOR", this->Name.c_str()); + // Load the project specific config file + const char* config = + this->GetOption("CPACK_PROJECT_CONFIG_FILE"); + if(config) + { + mf->ReadListFile(config); + } int result = this->InitializeInternal(); if (cmSystemTools::GetErrorOccuredFlag()) {