|
@@ -306,140 +306,143 @@ int main (int argc, char *argv[])
|
|
|
{
|
|
{
|
|
|
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
|
|
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
|
|
|
"CPack generator not specified" << std::endl);
|
|
"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,
|
|
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
|
|
|
- "Cannot initialize CPack generator: "
|
|
|
|
|
- << generator.c_str() << std::endl);
|
|
|
|
|
|
|
+ "CPack project name not specified" << std::endl);
|
|
|
parsed = 0;
|
|
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,
|
|
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;
|
|
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
|
|
#undef cout
|
|
|
- return doc.PrintRequestedDocumentation(std::cout)? 0:1;
|
|
|
|
|
|
|
+ return doc.PrintRequestedDocumentation(std::cout)? 0:1;
|
|
|
#define cout no_cout_use_cmCPack_Log
|
|
#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;
|
|
return 0;
|
|
|
}
|
|
}
|