summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-10-27 14:53:01 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2004-10-27 14:53:01 (GMT)
commit36c8f1d15792192790f0841d5658a105f44b420b (patch)
tree488e5dcf19787ed344fb62e7724964b6d899f393
parent56234aed4bfc87b691897056c4535b4d8cb3098f (diff)
downloadCMake-36c8f1d15792192790f0841d5658a105f44b420b.zip
CMake-36c8f1d15792192790f0841d5658a105f44b420b.tar.gz
CMake-36c8f1d15792192790f0841d5658a105f44b420b.tar.bz2
ENH: put error checking for missing linker languages
-rw-r--r--Source/cmLocalGenerator.cxx18
-rw-r--r--Source/cmLocalUnixMakefileGenerator.cxx25
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx6
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx22
4 files changed, 68 insertions, 3 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 5b72a80..a454e52 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -598,6 +598,12 @@ void cmLocalGenerator::CreateCustomTargetsAndCommands(std::set<cmStdString> cons
case cmTarget::EXECUTABLE:
{
const char* llang = target.GetLinkerLanguage(this->GetGlobalGenerator());
+ if(!llang)
+ {
+ cmSystemTools::Error("CMake can not determine linker language for target:",
+ target.GetName());
+ return;
+ }
// if the language is not in the set lang then create custom
// commands to build the target
if(lang.count(llang) == 0)
@@ -988,6 +994,12 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
linkFlags += " ";
}
const char* linkLanguage = target.GetLinkerLanguage(this->GetGlobalGenerator());
+ if(!linkLanguage)
+ {
+ cmSystemTools::Error("CMake can not determine linker language for target:",
+ target.GetName());
+ return;
+ }
std::string langVar = "CMAKE_";
langVar += linkLanguage;
std::string flagsVar = langVar + "_FLAGS";
@@ -1056,6 +1068,12 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout,
buildType = cmSystemTools::UpperCase(buildType);
const char* linkLanguage = tgt.GetLinkerLanguage(this->GetGlobalGenerator());
+ if(!linkLanguage)
+ {
+ cmSystemTools::Error("CMake can not determine linker language for target:",
+ tgt.GetName());
+ return;
+ }
std::string runTimeFlagVar = "CMAKE_SHARED_LIBRARY_RUNTIME_";
runTimeFlagVar += linkLanguage;
runTimeFlagVar += "_FLAG";
diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx
index 827ad72..9ff5624 100644
--- a/Source/cmLocalUnixMakefileGenerator.cxx
+++ b/Source/cmLocalUnixMakefileGenerator.cxx
@@ -876,6 +876,12 @@ void cmLocalUnixMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout,
const cmTarget &t)
{
const char* linkLanguage = t.GetLinkerLanguage(this->GetGlobalGenerator());
+ if(!linkLanguage)
+ {
+ cmSystemTools::Error("CMake can not determine linker language target:",
+ t.GetName());
+ return;
+ }
std::string createRule = "CMAKE_";
createRule += linkLanguage;
createRule += "_CREATE_SHARED_LIBRARY";
@@ -922,6 +928,12 @@ void cmLocalUnixMakefileGenerator::OutputModuleLibraryRule(std::ostream& fout,
const cmTarget &t)
{
const char* linkLanguage = t.GetLinkerLanguage(this->GetGlobalGenerator());
+ if(!linkLanguage)
+ {
+ cmSystemTools::Error("CMake can not determine linker language for target:",
+ t.GetName());
+ return;
+ }
std::string createRule = "CMAKE_";
createRule += linkLanguage;
createRule += "_CREATE_SHARED_MODULE";
@@ -954,6 +966,12 @@ void cmLocalUnixMakefileGenerator::OutputStaticLibraryRule(std::ostream& fout,
const cmTarget &t)
{
const char* linkLanguage = t.GetLinkerLanguage(this->GetGlobalGenerator());
+ if(!linkLanguage)
+ {
+ cmSystemTools::Error("CMake can not determine linker language for target:",
+ t.GetName());
+ return;
+ }
std::string createRule = "CMAKE_";
createRule += linkLanguage;
createRule += "_CREATE_STATIC_LIBRARY";
@@ -1034,7 +1052,12 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
linkFlags += " ";
}
const char* linkLanguage = t.GetLinkerLanguage(this->GetGlobalGenerator());
-
+ if(!linkLanguage)
+ {
+ cmSystemTools::Error("CMake can not determine linker language for target:",
+ t.GetName());
+ return;
+ }
std::string langVar = "CMAKE_";
langVar += linkLanguage;
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 56308e3..0f74c20 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -1065,6 +1065,12 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
target.GetType() <= cmTarget::MODULE_LIBRARY)
{
const char* linkLanguage = target.GetLinkerLanguage(this->GetGlobalGenerator());
+ if(!linkLanguage)
+ {
+ cmSystemTools::Error("CMake can not determine linker language for target:",
+ target.GetName());
+ return;
+ }
// if CXX is on and the target contains cxx code then add the cxx flags
std::string baseFlagVar = "CMAKE_";
baseFlagVar += linkLanguage;
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 0087b3e..4718974 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -329,6 +329,12 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
if(strcmp(configType, "10") != 0)
{
const char* linkLanguage = target.GetLinkerLanguage(this->GetGlobalGenerator());
+ if(!linkLanguage)
+ {
+ cmSystemTools::Error("CMake can not determine linker language for target:",
+ target.GetName());
+ return;
+ }
std::string baseFlagVar = "CMAKE_";
baseFlagVar += linkLanguage;
baseFlagVar += "_FLAGS";
@@ -629,6 +635,12 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
fout << "\t\t\t\tGenerateDebugInformation=\"TRUE\"\n";
}
const char* linkLanguage = target.GetLinkerLanguage(this->GetGlobalGenerator());
+ if(!linkLanguage)
+ {
+ cmSystemTools::Error("CMake can not determine linker language for target:",
+ target.GetName());
+ return;
+ }
std::string stackVar = "CMAKE_";
stackVar += linkLanguage;
stackVar += "_STACK_SIZE";
@@ -697,8 +709,14 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
{
fout << "\t\t\t\tSubSystem=\"1\"\n";
}
- const char* linkLanguage = target.GetLinkerLanguage(this->GetGlobalGenerator());
- std::string stackVar = "CMAKE_";
+ const char* linkLanguage = target.GetLinkerLanguage(this->GetGlobalGenerator());
+ if(!linkLanguage)
+ {
+ cmSystemTools::Error("CMake can not determine linker language for target:",
+ target.GetName());
+ return;
+ }
+ std::string stackVar = "CMAKE_";
stackVar += linkLanguage;
stackVar += "_STACK_SIZE";
const char* stackVal = m_Makefile->GetDefinition(stackVar.c_str());