|  | @@ -264,6 +264,23 @@ int cmCPackGenerator::InstallProject()
 | 
	
		
			
				|  |  |      return 0;
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +  // Run pre-build actions
 | 
	
		
			
				|  |  | +  const char* preBuildScripts = this->GetOption("CPACK_PRE_BUILD_SCRIPTS");
 | 
	
		
			
				|  |  | +  if (preBuildScripts) {
 | 
	
		
			
				|  |  | +    const auto scripts = cmExpandedList(preBuildScripts, false);
 | 
	
		
			
				|  |  | +    for (const auto& script : scripts) {
 | 
	
		
			
				|  |  | +      cmCPackLogger(cmCPackLog::LOG_OUTPUT,
 | 
	
		
			
				|  |  | +                    "Executing pre-build script: " << script << std::endl);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      if (!this->MakefileMap->ReadListFile(script)) {
 | 
	
		
			
				|  |  | +        cmCPackLogger(cmCPackLog::LOG_ERROR,
 | 
	
		
			
				|  |  | +                      "The pre-build script not found: " << script
 | 
	
		
			
				|  |  | +                                                         << std::endl);
 | 
	
		
			
				|  |  | +        return 0;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |    if (setDestDir) {
 | 
	
		
			
				|  |  |      cmSystemTools::PutEnv("DESTDIR=");
 | 
	
		
			
				|  |  |    }
 | 
	
	
		
			
				|  | @@ -333,7 +350,8 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
 | 
	
		
			
				|  |  |      if (installDirectoriesVector.size() % 2 != 0) {
 | 
	
		
			
				|  |  |        cmCPackLogger(
 | 
	
		
			
				|  |  |          cmCPackLog::LOG_ERROR,
 | 
	
		
			
				|  |  | -        "CPACK_INSTALLED_DIRECTORIES should contain pairs of <directory> and "
 | 
	
		
			
				|  |  | +        "CPACK_INSTALLED_DIRECTORIES should contain pairs of <directory> "
 | 
	
		
			
				|  |  | +        "and "
 | 
	
		
			
				|  |  |          "<subdirectory>. The <subdirectory> can be '.' to be installed in "
 | 
	
		
			
				|  |  |          "the toplevel directory of installation."
 | 
	
		
			
				|  |  |            << std::endl);
 | 
	
	
		
			
				|  | @@ -475,10 +493,10 @@ int cmCPackGenerator::InstallProjectViaInstallScript(
 | 
	
		
			
				|  |  |                      "- Install script: " << installScript << std::endl);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |        if (setDestDir) {
 | 
	
		
			
				|  |  | -        // For DESTDIR based packaging, use the *project* CMAKE_INSTALL_PREFIX
 | 
	
		
			
				|  |  | -        // underneath the tempInstallDirectory. The value of the project's
 | 
	
		
			
				|  |  | -        // CMAKE_INSTALL_PREFIX is sent in here as the value of the
 | 
	
		
			
				|  |  | -        // CPACK_INSTALL_PREFIX variable.
 | 
	
		
			
				|  |  | +        // For DESTDIR based packaging, use the *project*
 | 
	
		
			
				|  |  | +        // CMAKE_INSTALL_PREFIX underneath the tempInstallDirectory. The
 | 
	
		
			
				|  |  | +        // value of the project's CMAKE_INSTALL_PREFIX is sent in here as the
 | 
	
		
			
				|  |  | +        // value of the CPACK_INSTALL_PREFIX variable.
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          std::string dir;
 | 
	
		
			
				|  |  |          if (this->GetOption("CPACK_INSTALL_PREFIX")) {
 | 
	
	
		
			
				|  | @@ -1076,6 +1094,25 @@ int cmCPackGenerator::DoPackage()
 | 
	
		
			
				|  |  |        return 0;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | +  // Run post-build actions
 | 
	
		
			
				|  |  | +  const char* postBuildScripts = this->GetOption("CPACK_POST_BUILD_SCRIPTS");
 | 
	
		
			
				|  |  | +  if (postBuildScripts) {
 | 
	
		
			
				|  |  | +    this->MakefileMap->AddDefinition("CPACK_PACKAGE_FILES",
 | 
	
		
			
				|  |  | +                                     cmJoin(this->packageFileNames, ";"));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    const auto scripts = cmExpandedList(postBuildScripts, false);
 | 
	
		
			
				|  |  | +    for (const auto& script : scripts) {
 | 
	
		
			
				|  |  | +      cmCPackLogger(cmCPackLog::LOG_OUTPUT,
 | 
	
		
			
				|  |  | +                    "Executing post-build script: " << script << std::endl);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      if (!this->MakefileMap->ReadListFile(script)) {
 | 
	
		
			
				|  |  | +        cmCPackLogger(cmCPackLog::LOG_ERROR,
 | 
	
		
			
				|  |  | +                      "The post-build script not found: " << script
 | 
	
		
			
				|  |  | +                                                          << std::endl);
 | 
	
		
			
				|  |  | +        return 0;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    /* Prepare checksum algorithm*/
 | 
	
		
			
				|  |  |    const char* algo = this->GetOption("CPACK_PACKAGE_CHECKSUM");
 | 
	
	
		
			
				|  | @@ -1378,7 +1415,8 @@ int cmCPackGenerator::PrepareGroupingKind()
 | 
	
		
			
				|  |  |            << std::endl);
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  // if user specified packaging method, override the default packaging method
 | 
	
		
			
				|  |  | +  // if user specified packaging method, override the default packaging
 | 
	
		
			
				|  |  | +  // method
 | 
	
		
			
				|  |  |    if (method != UNKNOWN_COMPONENT_PACKAGE_METHOD) {
 | 
	
		
			
				|  |  |      componentPackageMethod = method;
 | 
	
		
			
				|  |  |    }
 |