diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-07-28 13:14:17 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-07-28 13:14:17 (GMT) |
commit | b0d7f6999b0dac288206d17bf008d34c1d633ba9 (patch) | |
tree | bc5d1b977da8570b25c7f06fae8a5bc973403f76 | |
parent | 40b6db1f4bd6f9cca19d7cf5cc09c170e8f416c4 (diff) | |
download | CMake-b0d7f6999b0dac288206d17bf008d34c1d633ba9.zip CMake-b0d7f6999b0dac288206d17bf008d34c1d633ba9.tar.gz CMake-b0d7f6999b0dac288206d17bf008d34c1d633ba9.tar.bz2 |
BUG: Bail out on generator initialization failure
-rw-r--r-- | Source/CPack/cpack.cxx | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 9c51d18..c2a26ad 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -372,38 +372,41 @@ int main (int argc, char *argv[]) << std::endl); parsed = 0; } + if ( parsed ) + { #ifdef _WIN32 - std::string comspec = "cmw9xcom.exe"; - cmSystemTools::SetWindows9xComspecSubstitute(comspec.c_str()); + 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; + 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; + } } } } |