Merge topic 'CPack-honorCPACK_XXX-valuesInScriptFile'

05a8630 Do not provide defaul value for CPACK_PACKAGE_DIRECTORY if found in config.
This commit is contained in:
David Cole 2012-07-09 14:23:28 -04:00 committed by CMake Topic Stage
commit b636728e39
2 changed files with 24 additions and 3 deletions

View File

@ -63,6 +63,14 @@
##end
#
##variable
# CPACK_PACKAGE_DIRECTORY - The directory in which CPack is doing its
# packaging. If it is not set then this will default (internally) to the
# build dir. This variable may be defined in CPack config file or from
# the cpack command line option "-B". If set the command line option
# override the value found in the config file.
##end
#
##variable
# CPACK_PACKAGE_VERSION_MAJOR - Package major Version
##end
#

View File

@ -207,8 +207,7 @@ int main (int argc, char *argv[])
std::string helpHTML;
std::string cpackProjectName;
std::string cpackProjectDirectory
= cmsys::SystemTools::GetCurrentWorkingDirectory();
std::string cpackProjectDirectory;
std::string cpackBuildConfig;
std::string cpackProjectVersion;
std::string cpackProjectPatch;
@ -374,10 +373,24 @@ int main (int argc, char *argv[])
globalMF->AddDefinition("CPACK_PACKAGE_VENDOR",
cpackProjectVendor.c_str());
}
// if this is not empty it has been set on the command line
// go for it. Command line override values set in config file.
if ( !cpackProjectDirectory.empty() )
{
globalMF->AddDefinition("CPACK_PACKAGE_DIRECTORY",
cpackProjectDirectory.c_str());
cpackProjectDirectory.c_str());
}
// The value has not been set on the command line
else
{
// get a default value (current working directory)
cpackProjectDirectory = cmsys::SystemTools::GetCurrentWorkingDirectory();
// use default value iff no value has been provided by the config file
if (!globalMF->IsSet("CPACK_PACKAGE_DIRECTORY"))
{
globalMF->AddDefinition("CPACK_PACKAGE_DIRECTORY",
cpackProjectDirectory.c_str());
}
}
if ( !cpackBuildConfig.empty() )
{