Fix some generator crashes on undefined CMAKE_BUILD_TYPE

Since commit 84fdc9921 (stringapi: Pass configuration names as strings,
2014-02-09), it is not safe to use GetDefinition("CMAKE_BUILD_TYPE")
without checking the return value.  Use GetSafeDefinition instead so
that a missing definition is treated as an empty string like code paths
did prior to the above commit.

Reported-by: Richard Wirth <richard@califax.de>
This commit is contained in:
Brad King
2014-06-23 09:34:38 -04:00
parent 562d5f576a
commit c491cb1eb4
3 changed files with 3 additions and 3 deletions

View File

@@ -574,7 +574,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
}
}
const char* buildType = makefile->GetDefinition("CMAKE_BUILD_TYPE");
std::string buildType = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
std::string location;
if ( target->GetType()==cmTarget::OBJECT_LIBRARY)
{