فهرست منبع

ENH: add CPACK_PROJECT_CONFIG_FILE option to CPack

Bill Hoffman 18 سال پیش
والد
کامیت
e65c40f94a
4فایلهای تغییر یافته به همراه18 افزوده شده و 12 حذف شده
  1. 3 0
      CMakeCPack.cmake
  2. 6 3
      CMakeCPackOptions.cmake.in
  3. 0 8
      CPackSourceConfig.cmake.in
  4. 9 1
      Source/CPack/cmCPackGenericGenerator.cxx

+ 3 - 0
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")

+ 6 - 3
CPackConfig.cmake.in → 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")

+ 0 - 8
CPackSourceConfig.cmake.in

@@ -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")

+ 9 - 1
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())
     {