BUG: Bail out on generator initialization failure

This commit is contained in:
Andy Cedilnik 2006-07-28 09:14:17 -04:00
parent 40b6db1f4b
commit b0d7f6999b
1 changed files with 32 additions and 29 deletions

View File

@ -372,38 +372,41 @@ int main (int argc, char *argv[])
<< std::endl); << std::endl);
parsed = 0; parsed = 0;
} }
if ( parsed )
{
#ifdef _WIN32 #ifdef _WIN32
std::string comspec = "cmw9xcom.exe"; std::string comspec = "cmw9xcom.exe";
cmSystemTools::SetWindows9xComspecSubstitute(comspec.c_str()); cmSystemTools::SetWindows9xComspecSubstitute(comspec.c_str());
#endif #endif
const char* projName = mf->GetDefinition("CPACK_PACKAGE_NAME"); const char* projName = mf->GetDefinition("CPACK_PACKAGE_NAME");
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "Use generator: " cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "Use generator: "
<< cpackGenerator->GetNameOfClass() << std::endl); << cpackGenerator->GetNameOfClass() << std::endl);
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "For project: " cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "For project: "
<< projName << std::endl); << projName << std::endl);
const char* projVersion = mf->GetDefinition("CPACK_PACKAGE_VERSION"); const char* projVersion = mf->GetDefinition("CPACK_PACKAGE_VERSION");
if ( !projVersion ) if ( !projVersion )
{ {
const char* projVersionMajor const char* projVersionMajor
= mf->GetDefinition("CPACK_PACKAGE_VERSION_MAJOR"); = mf->GetDefinition("CPACK_PACKAGE_VERSION_MAJOR");
const char* projVersionMinor const char* projVersionMinor
= mf->GetDefinition("CPACK_PACKAGE_VERSION_MINOR"); = mf->GetDefinition("CPACK_PACKAGE_VERSION_MINOR");
const char* projVersionPatch const char* projVersionPatch
= mf->GetDefinition("CPACK_PACKAGE_VERSION_PATCH"); = mf->GetDefinition("CPACK_PACKAGE_VERSION_PATCH");
cmOStringStream ostr; cmOStringStream ostr;
ostr << projVersionMajor << "." << projVersionMinor << "." ostr << projVersionMajor << "." << projVersionMinor << "."
<< projVersionPatch; << projVersionPatch;
mf->AddDefinition("CPACK_PACKAGE_VERSION", ostr.str().c_str()); mf->AddDefinition("CPACK_PACKAGE_VERSION", ostr.str().c_str());
} }
int res = cpackGenerator->ProcessGenerator(); int res = cpackGenerator->ProcessGenerator();
if ( !res ) if ( !res )
{ {
cmCPack_Log(&log, cmCPackLog::LOG_ERROR, cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
"Error when generating package: " << projName << std::endl); "Error when generating package: " << projName << std::endl);
return 1; return 1;
}
} }
} }
} }