summaryrefslogtreecommitdiffstats
path: root/Source/CPack/cpack.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2006-07-27 15:55:34 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2006-07-27 15:55:34 (GMT)
commit7e3310e6e52a43e63fbdabc71a29c559690807a6 (patch)
tree917a3852e1e5393604168d91865866811f4eaa27 /Source/CPack/cpack.cxx
parent0b196d1aeffe5837f54410d8ed57278a36363e87 (diff)
downloadCMake-7e3310e6e52a43e63fbdabc71a29c559690807a6.zip
CMake-7e3310e6e52a43e63fbdabc71a29c559690807a6.tar.gz
CMake-7e3310e6e52a43e63fbdabc71a29c559690807a6.tar.bz2
BUG: Fix executing and help
Diffstat (limited to 'Source/CPack/cpack.cxx')
-rw-r--r--Source/CPack/cpack.cxx229
1 files changed, 116 insertions, 113 deletions
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index e1ab872..9c51d18 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -306,140 +306,143 @@ int main (int argc, char *argv[])
{
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
"CPack generator not specified" << std::endl);
- return 1;
+ parsed = 0;
}
- std::vector<std::string> generatorsVector;
- cmSystemTools::ExpandListArgument(genList,
- generatorsVector);
- std::vector<std::string>::iterator it;
- for ( it = generatorsVector.begin();
- it != generatorsVector.end();
- ++it )
+ else
{
- const char* gen = it->c_str();
- cmMakefile newMF(*globalMF);
- cmMakefile* mf = &newMF;
+ std::vector<std::string> generatorsVector;
+ cmSystemTools::ExpandListArgument(genList,
+ generatorsVector);
+ std::vector<std::string>::iterator it;
+ for ( it = generatorsVector.begin();
+ it != generatorsVector.end();
+ ++it )
{
- cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
- "Specified generator: " << gen << std::endl);
- if ( parsed && !mf->GetDefinition("CPACK_PACKAGE_NAME") )
- {
- cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
- "CPack project name not specified" << std::endl);
- parsed = 0;
- }
- if ( parsed && !(mf->GetDefinition("CPACK_PACKAGE_VERSION")
- || mf->GetDefinition("CPACK_PACKAGE_VERSION_MAJOR") &&
- mf->GetDefinition("CPACK_PACKAGE_VERSION_MINOR")
- && mf->GetDefinition("CPACK_PACKAGE_VERSION_PATCH")) )
- {
- cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
- "CPack project version not specified" << std::endl
- << "Specify CPACK_PACKAGE_VERSION, or "
- "CPACK_PACKAGE_VERSION_MAJOR, "
- "CPACK_PACKAGE_VERSION_MINOR, and CPACK_PACKAGE_VERSION_PATCH."
- << std::endl);
- parsed = 0;
- }
- if ( parsed )
+ const char* gen = it->c_str();
+ cmMakefile newMF(*globalMF);
+ cmMakefile* mf = &newMF;
{
- cpackGenerator = generators.NewGenerator(gen);
- if ( !cpackGenerator )
+ cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
+ "Specified generator: " << gen << std::endl);
+ if ( parsed && !mf->GetDefinition("CPACK_PACKAGE_NAME") )
{
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
- "Cannot initialize CPack generator: "
- << generator.c_str() << std::endl);
+ "CPack project name not specified" << std::endl);
parsed = 0;
}
- if ( parsed && !cpackGenerator->Initialize(gen, mf, argv[0]) )
+ if ( parsed && !(mf->GetDefinition("CPACK_PACKAGE_VERSION")
+ || mf->GetDefinition("CPACK_PACKAGE_VERSION_MAJOR") &&
+ mf->GetDefinition("CPACK_PACKAGE_VERSION_MINOR")
+ && mf->GetDefinition("CPACK_PACKAGE_VERSION_PATCH")) )
{
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
- "Cannot initialize the generator" << std::endl);
+ "CPack project version not specified" << std::endl
+ << "Specify CPACK_PACKAGE_VERSION, or "
+ "CPACK_PACKAGE_VERSION_MAJOR, "
+ "CPACK_PACKAGE_VERSION_MINOR, and CPACK_PACKAGE_VERSION_PATCH."
+ << std::endl);
parsed = 0;
}
-
- if ( !mf->GetDefinition("CPACK_INSTALL_COMMANDS") &&
- !mf->GetDefinition("CPACK_INSTALLED_DIRECTORIES") &&
- !mf->GetDefinition("CPACK_INSTALL_CMAKE_PROJECTS") )
+ if ( parsed )
{
- cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
- "Please specify build tree of the project that uses CMake "
- "using CPACK_INSTALL_CMAKE_PROJECTS, specify "
- "CPACK_INSTALL_COMMANDS, or specify "
- "CPACK_INSTALLED_DIRECTORIES."
- << std::endl);
- parsed = 0;
+ cpackGenerator = generators.NewGenerator(gen);
+ if ( !cpackGenerator )
+ {
+ cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
+ "Cannot initialize CPack generator: "
+ << generator.c_str() << std::endl);
+ parsed = 0;
+ }
+ if ( parsed && !cpackGenerator->Initialize(gen, mf, argv[0]) )
+ {
+ cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
+ "Cannot initialize the generator" << std::endl);
+ parsed = 0;
+ }
+
+ if ( !mf->GetDefinition("CPACK_INSTALL_COMMANDS") &&
+ !mf->GetDefinition("CPACK_INSTALLED_DIRECTORIES") &&
+ !mf->GetDefinition("CPACK_INSTALL_CMAKE_PROJECTS") )
+ {
+ cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
+ "Please specify build tree of the project that uses CMake "
+ "using CPACK_INSTALL_CMAKE_PROJECTS, specify "
+ "CPACK_INSTALL_COMMANDS, or specify "
+ "CPACK_INSTALLED_DIRECTORIES."
+ << std::endl);
+ parsed = 0;
+ }
+#ifdef _WIN32
+ std::string comspec = "cmw9xcom.exe";
+ cmSystemTools::SetWindows9xComspecSubstitute(comspec.c_str());
+#endif
+
+ const char* projName = mf->GetDefinition("CPACK_PACKAGE_NAME");
+ cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "Use generator: "
+ << cpackGenerator->GetNameOfClass() << std::endl);
+ cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "For project: "
+ << projName << std::endl);
+
+ const char* projVersion = mf->GetDefinition("CPACK_PACKAGE_VERSION");
+ if ( !projVersion )
+ {
+ const char* projVersionMajor
+ = mf->GetDefinition("CPACK_PACKAGE_VERSION_MAJOR");
+ const char* projVersionMinor
+ = mf->GetDefinition("CPACK_PACKAGE_VERSION_MINOR");
+ const char* projVersionPatch
+ = mf->GetDefinition("CPACK_PACKAGE_VERSION_PATCH");
+ cmOStringStream ostr;
+ ostr << projVersionMajor << "." << projVersionMinor << "."
+ << projVersionPatch;
+ mf->AddDefinition("CPACK_PACKAGE_VERSION", ostr.str().c_str());
+ }
+
+ int res = cpackGenerator->ProcessGenerator();
+ if ( !res )
+ {
+ cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
+ "Error when generating package: " << projName << std::endl);
+ return 1;
+ }
}
}
}
+ }
+ }
- if ( !parsed || help )
- {
- doc.CheckOptions(argc, argv);
- // Construct and print requested documentation.
- doc.SetName("cpack");
- doc.SetNameSection(cmDocumentationName);
- doc.SetUsageSection(cmDocumentationUsage);
- doc.SetDescriptionSection(cmDocumentationDescription);
- doc.SetOptionsSection(cmDocumentationOptions);
-
- std::vector<cmDocumentationEntry> v;
- cmCPackGenerators::DescriptionsMap::const_iterator generatorIt;
- for( generatorIt = generators.GetGeneratorsList().begin();
- generatorIt != generators.GetGeneratorsList().end();
- ++ generatorIt )
- {
- cmDocumentationEntry e;
- e.name = generatorIt->first.c_str();
- e.brief = generatorIt->second.c_str();
- e.full = "";
- v.push_back(e);
- }
- cmDocumentationEntry empty = {0,0,0};
- v.push_back(empty);
- doc.SetGeneratorsSection(&v[0]);
+ if ( !parsed || help )
+ {
+ doc.CheckOptions(argc, argv);
+ // Construct and print requested documentation.
+ doc.SetName("cpack");
+ doc.SetNameSection(cmDocumentationName);
+ doc.SetUsageSection(cmDocumentationUsage);
+ doc.SetDescriptionSection(cmDocumentationDescription);
+ doc.SetOptionsSection(cmDocumentationOptions);
+
+ std::vector<cmDocumentationEntry> v;
+ cmCPackGenerators::DescriptionsMap::const_iterator generatorIt;
+ for( generatorIt = generators.GetGeneratorsList().begin();
+ generatorIt != generators.GetGeneratorsList().end();
+ ++ generatorIt )
+ {
+ cmDocumentationEntry e;
+ e.name = generatorIt->first.c_str();
+ e.brief = generatorIt->second.c_str();
+ e.full = "";
+ v.push_back(e);
+ }
+ cmDocumentationEntry empty = {0,0,0};
+ v.push_back(empty);
+ doc.SetGeneratorsSection(&v[0]);
- doc.SetSeeAlsoList(cmDocumentationSeeAlso);
+ doc.SetSeeAlsoList(cmDocumentationSeeAlso);
#undef cout
- return doc.PrintRequestedDocumentation(std::cout)? 0:1;
+ return doc.PrintRequestedDocumentation(std::cout)? 0:1;
#define cout no_cout_use_cmCPack_Log
- }
-
-#ifdef _WIN32
- std::string comspec = "cmw9xcom.exe";
- cmSystemTools::SetWindows9xComspecSubstitute(comspec.c_str());
-#endif
-
- const char* projName = mf->GetDefinition("CPACK_PACKAGE_NAME");
- cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "Use generator: "
- << cpackGenerator->GetNameOfClass() << std::endl);
- cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "For project: "
- << projName << std::endl);
-
- const char* projVersion = mf->GetDefinition("CPACK_PACKAGE_VERSION");
- if ( !projVersion )
- {
- const char* projVersionMajor
- = mf->GetDefinition("CPACK_PACKAGE_VERSION_MAJOR");
- const char* projVersionMinor
- = mf->GetDefinition("CPACK_PACKAGE_VERSION_MINOR");
- const char* projVersionPatch
- = mf->GetDefinition("CPACK_PACKAGE_VERSION_PATCH");
- cmOStringStream ostr;
- ostr << projVersionMajor << "." << projVersionMinor << "."
- << projVersionPatch;
- mf->AddDefinition("CPACK_PACKAGE_VERSION", ostr.str().c_str());
- }
-
- int res = cpackGenerator->ProcessGenerator();
- if ( !res )
- {
- cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
- "Error when generating package: " << projName << std::endl);
- return 1;
- }
- }
}
+
return 0;
}