summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-08-11 20:58:09 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2004-08-11 20:58:09 (GMT)
commitb41d447935c518c5d3352284afd8b24732985417 (patch)
tree9bef9c2493dc6b330a7edccfec40d19c8e09e556
parentbb32a51825648f5fe44c12df8a3becd5aa88061e (diff)
downloadCMake-b41d447935c518c5d3352284afd8b24732985417.zip
CMake-b41d447935c518c5d3352284afd8b24732985417.tar.gz
CMake-b41d447935c518c5d3352284afd8b24732985417.tar.bz2
ENH: use GetRequiredDefinition instead of GetDefinition and crash
-rw-r--r--Source/cmAbstractFilesCommand.cxx2
-rw-r--r--Source/cmAddExecutableCommand.cxx2
-rw-r--r--Source/cmCreateTestSourceList.cxx2
-rw-r--r--Source/cmGlobalCodeWarriorGenerator.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx4
-rw-r--r--Source/cmGlobalUnixMakefileGenerator.cxx4
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx30
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx39
-rw-r--r--Source/cmUtilitySourceCommand.cxx2
9 files changed, 44 insertions, 43 deletions
diff --git a/Source/cmAbstractFilesCommand.cxx b/Source/cmAbstractFilesCommand.cxx
index 653579d..7baf743 100644
--- a/Source/cmAbstractFilesCommand.cxx
+++ b/Source/cmAbstractFilesCommand.cxx
@@ -23,7 +23,7 @@
bool cmAbstractFilesCommand::InitialPass(std::vector<std::string> const& args)
{
const char* versionValue
- = m_Makefile->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
+ = m_Makefile->GetRequiredDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
if (atof(versionValue) > 1.4)
{
this->SetError("The ABSTRACT_FILES command was deprecated in CMake version 1.4 and will be removed in later versions of CMake. You should modify your CMakeLists.txt files to use the SET command instead, or set the cache value of CMAKE_BACKWARDS_COMPATIBILITY to 1.2 or less.\n");
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index 6e3e680..8b5f24c 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -65,7 +65,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args)
this->SetError("could not find Mac OSX bundle template file.");
return false;
}
- std::string macdir = m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH");
+ std::string macdir = m_Makefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH");
if ( macdir.size() == 0 )
{
macdir = m_Makefile->GetCurrentOutputDirectory();
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx
index 5dddb9e..04b1dad 100644
--- a/Source/cmCreateTestSourceList.cxx
+++ b/Source/cmCreateTestSourceList.cxx
@@ -82,7 +82,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args)
++i;
std::string configFile =
- m_Makefile->GetDefinition("CMAKE_ROOT");
+ m_Makefile->GetRequiredDefinition("CMAKE_ROOT");
configFile += "/Templates/TestDriver.cxx.in";
// Create the test driver file
diff --git a/Source/cmGlobalCodeWarriorGenerator.cxx b/Source/cmGlobalCodeWarriorGenerator.cxx
index 0a9c1b5..735c5c8 100644
--- a/Source/cmGlobalCodeWarriorGenerator.cxx
+++ b/Source/cmGlobalCodeWarriorGenerator.cxx
@@ -33,7 +33,7 @@ void cmGlobalCodeWarriorGenerator::EnableLanguage(const char*,
if(!this->GetLanguageEnabled("CXX"))
{
std::string fpath =
- mf->GetDefinition("CMAKE_ROOT");
+ mf->GetRequiredDefinition("CMAKE_ROOT");
fpath += "/Templates/CMakeCodeWarriorConfig.cmake";
mf->ReadListFile(0,fpath.c_str());
this->SetLanguageEnabled("CXX");
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index a4c1e25..d33694b 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -53,7 +53,7 @@ void cmGlobalGenerator::EnableLanguage(const char* lang,
"Generator implementation error, "
"all generators must specify m_FindMakeProgramFile");
}
- std::string root = mf->GetDefinition("CMAKE_ROOT");
+ std::string root = mf->GetRequiredDefinition("CMAKE_ROOT");
if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM")
|| cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM")))
{
@@ -73,7 +73,7 @@ void cmGlobalGenerator::EnableLanguage(const char* lang,
cmSystemTools::SetFatalErrorOccured();
return;
}
- std::string makeProgram = mf->GetDefinition("CMAKE_MAKE_PROGRAM");
+ std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
// if there are spaces in the make program use short path
// but do not short path the actual program name, as
// this can cause trouble with VSExpress
diff --git a/Source/cmGlobalUnixMakefileGenerator.cxx b/Source/cmGlobalUnixMakefileGenerator.cxx
index 8719fbd..463c209 100644
--- a/Source/cmGlobalUnixMakefileGenerator.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator.cxx
@@ -43,7 +43,7 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
cmSystemTools::Error("CMAKE_C_COMPILER not set, after EnableLanguage");
return;
}
- const char* cc = mf->GetDefinition("CMAKE_C_COMPILER");
+ const char* cc = mf->GetRequiredDefinition("CMAKE_C_COMPILER");
std::string path = cmSystemTools::FindProgram(cc);
if(path.size() == 0)
{
@@ -64,7 +64,7 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
}
if(strcmp(lang, "CXX") == 0)
{
- const char* cxx = mf->GetDefinition("CMAKE_CXX_COMPILER");
+ const char* cxx = mf->GetRequiredDefinition("CMAKE_CXX_COMPILER");
path = cmSystemTools::FindProgram(cxx);
if(path.size() == 0)
{
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index f4ad36c..0febe1b 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -184,7 +184,7 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule()
argv.push_back(args);
std::string configFile =
- m_Makefile->GetDefinition("CMAKE_ROOT");
+ m_Makefile->GetRequiredDefinition("CMAKE_ROOT");
configFile += "/Templates/CMakeWindowsSystemConfig.cmake";
std::vector<std::string> listFiles = m_Makefile->GetListFiles();
bool found = false;
@@ -527,7 +527,7 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b,
const char* libName,
const cmTarget& target)
{
- std::string root= m_Makefile->GetDefinition("CMAKE_ROOT");
+ std::string root= m_Makefile->GetRequiredDefinition("CMAKE_ROOT");
const char *def= m_Makefile->GetDefinition( "MSPROJECT_TEMPLATE_DIRECTORY");
std::string exportSymbol;
@@ -924,15 +924,15 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
std::string extraLinkOptions;
if(target.GetType() == cmTarget::EXECUTABLE)
{
- extraLinkOptions = m_Makefile->GetDefinition("CMAKE_EXE_LINKER_FLAGS");
+ extraLinkOptions = m_Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS");
}
if(target.GetType() == cmTarget::SHARED_LIBRARY)
{
- extraLinkOptions = m_Makefile->GetDefinition("CMAKE_SHARED_LINKER_FLAGS");
+ extraLinkOptions = m_Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS");
}
if(target.GetType() == cmTarget::MODULE_LIBRARY)
{
- extraLinkOptions = m_Makefile->GetDefinition("CMAKE_MODULE_LINKER_FLAGS");
+ extraLinkOptions = m_Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS");
}
if(extraLinkOptions.size())
@@ -1059,30 +1059,30 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
// if CXX is on and the target contains cxx code then add the cxx flags
if ( gen->GetLanguageEnabled("CXX") && target.HasCxx() )
{
- flagsRelease = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_RELEASE");
+ flagsRelease = m_Makefile->GetRequiredDefinition("CMAKE_CXX_FLAGS_RELEASE");
flagsRelease += " -DCMAKE_INTDIR=\\\"Release\\\" ";
- flagsMinSize = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_MINSIZEREL");
+ flagsMinSize = m_Makefile->GetRequiredDefinition("CMAKE_CXX_FLAGS_MINSIZEREL");
flagsMinSize += " -DCMAKE_INTDIR=\\\"MinSizeRel\\\" ";
- flagsDebug = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_DEBUG");
+ flagsDebug = m_Makefile->GetRequiredDefinition("CMAKE_CXX_FLAGS_DEBUG");
flagsDebug += " -DCMAKE_INTDIR=\\\"Debug\\\" ";
- flagsDebugRel = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_RELWITHDEBINFO");
+ flagsDebugRel = m_Makefile->GetRequiredDefinition("CMAKE_CXX_FLAGS_RELWITHDEBINFO");
flagsDebugRel += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" ";
flags = " ";
- flags = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS");
+ flags = m_Makefile->GetRequiredDefinition("CMAKE_CXX_FLAGS");
}
// if C and the target is not CXX
else if(gen->GetLanguageEnabled("C") && !target.HasCxx())
{
- flagsRelease += m_Makefile->GetDefinition("CMAKE_C_FLAGS_RELEASE");
+ flagsRelease += m_Makefile->GetRequiredDefinition("CMAKE_C_FLAGS_RELEASE");
flagsRelease += " -DCMAKE_INTDIR=\\\"Release\\\"";
- flagsMinSize += m_Makefile->GetDefinition("CMAKE_C_FLAGS_MINSIZEREL");
+ flagsMinSize += m_Makefile->GetRequiredDefinition("CMAKE_C_FLAGS_MINSIZEREL");
flagsMinSize += " -DCMAKE_INTDIR=\\\"MinSizeRel\\\"";
- flagsDebug += m_Makefile->GetDefinition("CMAKE_C_FLAGS_DEBUG");
+ flagsDebug += m_Makefile->GetRequiredDefinition("CMAKE_C_FLAGS_DEBUG");
flagsDebug += " -DCMAKE_INTDIR=\\\"Debug\\\"";
- flagsDebugRel += m_Makefile->GetDefinition("CMAKE_C_FLAGS_RELWITHDEBINFO");
+ flagsDebugRel += m_Makefile->GetRequiredDefinition("CMAKE_C_FLAGS_RELWITHDEBINFO");
flagsDebugRel += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\"";
flags = " ";
- flags = m_Makefile->GetDefinition("CMAKE_C_FLAGS");
+ flags = m_Makefile->GetRequiredDefinition("CMAKE_C_FLAGS");
}
// if unicode is not found, then add -D_MBCS
if(flags.find("D_UNICODE") == flags.npos)
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 7e813cd..790cc1e 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -157,7 +157,7 @@ void cmLocalVisualStudio7Generator::AddVCProjBuildRule()
argv.push_back(args);
std::string configFile =
- m_Makefile->GetDefinition("CMAKE_ROOT");
+ m_Makefile->GetRequiredDefinition("CMAKE_ROOT");
configFile += "/Templates/CMakeWindowsSystemConfig.cmake";
std::vector<std::string> listFiles = m_Makefile->GetListFiles();
bool found = false;
@@ -324,19 +324,19 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
std::string flagsDebugRel = " ";
if(target.HasCxx())
{
- flags = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS");
- flagsRelease += m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_RELEASE");
- flagsMinSize += m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_MINSIZEREL");
- flagsDebug += m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_DEBUG");
- flagsDebugRel += m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_RELWITHDEBINFO");
+ flags = m_Makefile->GetRequiredDefinition("CMAKE_CXX_FLAGS");
+ flagsRelease += m_Makefile->GetRequiredDefinition("CMAKE_CXX_FLAGS_RELEASE");
+ flagsMinSize += m_Makefile->GetRequiredDefinition("CMAKE_CXX_FLAGS_MINSIZEREL");
+ flagsDebug += m_Makefile->GetRequiredDefinition("CMAKE_CXX_FLAGS_DEBUG");
+ flagsDebugRel += m_Makefile->GetRequiredDefinition("CMAKE_CXX_FLAGS_RELWITHDEBINFO");
}
else
{
- flags = m_Makefile->GetDefinition("CMAKE_C_FLAGS");
- flagsRelease += m_Makefile->GetDefinition("CMAKE_C_FLAGS_RELEASE");
- flagsMinSize += m_Makefile->GetDefinition("CMAKE_C_FLAGS_MINSIZEREL");
- flagsDebug += m_Makefile->GetDefinition("CMAKE_C_FLAGS_DEBUG");
- flagsDebugRel += m_Makefile->GetDefinition("CMAKE_C_FLAGS_RELWITHDEBINFO");
+ flags = m_Makefile->GetRequiredDefinition("CMAKE_C_FLAGS");
+ flagsRelease += m_Makefile->GetRequiredDefinition("CMAKE_C_FLAGS_RELEASE");
+ flagsMinSize += m_Makefile->GetRequiredDefinition("CMAKE_C_FLAGS_MINSIZEREL");
+ flagsDebug += m_Makefile->GetRequiredDefinition("CMAKE_C_FLAGS_DEBUG");
+ flagsDebugRel += m_Makefile->GetRequiredDefinition("CMAKE_C_FLAGS_RELWITHDEBINFO");
}
@@ -538,15 +538,15 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
std::string extraLinkOptions;
if(target.GetType() == cmTarget::EXECUTABLE)
{
- extraLinkOptions = m_Makefile->GetDefinition("CMAKE_EXE_LINKER_FLAGS");
+ extraLinkOptions = m_Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS");
}
if(target.GetType() == cmTarget::SHARED_LIBRARY)
{
- extraLinkOptions = m_Makefile->GetDefinition("CMAKE_SHARED_LINKER_FLAGS");
+ extraLinkOptions = m_Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS");
}
if(target.GetType() == cmTarget::MODULE_LIBRARY)
{
- extraLinkOptions = m_Makefile->GetDefinition("CMAKE_MODULE_LINKER_FLAGS");
+ extraLinkOptions = m_Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS");
}
const char* targetLinkFlags = target.GetProperty("LINK_FLAGS");
@@ -620,10 +620,10 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
{
fout << "\t\t\t\tGenerateDebugInformation=\"TRUE\"\n";
}
- if(const char* stacksize = m_Makefile->GetDefinition("CMAKE_CXX_STACK_SIZE"))
+ if(target.HasCxx())
{
fout << "\t\t\t\tStackReserveSize=\""
- << stacksize << "\"\n";
+ << m_Makefile->GetRequiredDefinition("CMAKE_CXX_STACK_SIZE") << "\"\n";
}
temp = m_LibraryOutputPath;
temp += configName;
@@ -645,7 +645,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
}
fout << "\"\n"
<< "\t\t\t\tAdditionalDependencies=\""
- << m_Makefile->GetDefinition("CMAKE_STANDARD_LIBRARIES")
+ << m_Makefile->GetRequiredDefinition("CMAKE_STANDARD_LIBRARIES")
<< " ";
this->OutputLibraries(fout, configName, libName, target);
fout << "\"\n";
@@ -683,11 +683,12 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
{
fout << "\t\t\t\tSubSystem=\"1\"\n";
}
- if(const char* stacksize = m_Makefile->GetDefinition("CMAKE_CXX_STACK_SIZE"))
+ if(target.HasCxx())
{
fout << "\t\t\t\tStackReserveSize=\""
- << stacksize << "\"/>\n";
+ << m_Makefile->GetRequiredDefinition("CMAKE_CXX_STACK_SIZE") << "\"";
}
+ fout << "/>\n";
break;
case cmTarget::UTILITY:
break;
diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx
index 9b542dc..3f5d13d 100644
--- a/Source/cmUtilitySourceCommand.cxx
+++ b/Source/cmUtilitySourceCommand.cxx
@@ -63,7 +63,7 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args)
}
// The source exists.
- std::string cmakeCFGout = m_Makefile->GetDefinition("CMAKE_CFG_INTDIR");
+ std::string cmakeCFGout = m_Makefile->GetRequiredDefinition("CMAKE_CFG_INTDIR");
std::string utilityDirectory = m_Makefile->GetCurrentOutputDirectory();
std::string exePath;
if (m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH"))