summaryrefslogtreecommitdiffstats
path: root/Source/cmExportCommand.cxx
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-06-08 20:19:13 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-06-08 20:19:13 (GMT)
commit33fe9c027fa7ece03cbbc7cd272c3b7f9f3cf501 (patch)
tree101f792a64c8c438b56f6f3ecabfd187bd40a228 /Source/cmExportCommand.cxx
parente37f8e2964e8415892eb31dce4c462173e95f69f (diff)
downloadCMake-33fe9c027fa7ece03cbbc7cd272c3b7f9f3cf501.zip
CMake-33fe9c027fa7ece03cbbc7cd272c3b7f9f3cf501.tar.gz
CMake-33fe9c027fa7ece03cbbc7cd272c3b7f9f3cf501.tar.bz2
ENH: fail if an unknown target is listed
Alex
Diffstat (limited to 'Source/cmExportCommand.cxx')
-rw-r--r--Source/cmExportCommand.cxx44
1 files changed, 32 insertions, 12 deletions
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index dfe5fa3..9575690 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -101,9 +101,25 @@ bool cmExportCommand
currentTarget != targets.end();
++currentTarget)
{
+ cmTarget* target = this->Makefile->GetLocalGenerator()->
+ GetGlobalGenerator()->FindTarget(0, currentTarget->c_str(), true);
+ if (target == 0)
+ {
+ std::string e = "detected unknown target: " + *currentTarget;
+ this->SetError(e.c_str());
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
+ }
+
+ for(std::vector<std::string>::const_iterator currentTarget = targets.begin();
+ currentTarget != targets.end();
+ ++currentTarget)
+ {
// Look for a CMake target with the given name, which is an executable
// and which can be run
- cmTarget* target = this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->FindTarget(0, currentTarget->c_str(), true);
+ cmTarget* target = this->Makefile->GetLocalGenerator()->
+ GetGlobalGenerator()->FindTarget(0, currentTarget->c_str(), true);
if ((target != 0)
&& ((target->GetType() == cmTarget::EXECUTABLE)
|| (target->GetType() == cmTarget::STATIC_LIBRARY)
@@ -113,24 +129,30 @@ bool cmExportCommand
switch (target->GetType())
{
case cmTarget::EXECUTABLE:
- fout << "ADD_EXECUTABLE(" << prefix.c_str() << currentTarget->c_str() << " IMPORT )\n";
+ fout << "ADD_EXECUTABLE(" << prefix.c_str() << currentTarget->c_str()
+ << " IMPORT )\n";
break;
case cmTarget::STATIC_LIBRARY:
- fout << "ADD_LIBRARY(" << prefix.c_str() << currentTarget->c_str() << " STATIC IMPORT )\n";
+ fout << "ADD_LIBRARY(" << prefix.c_str() << currentTarget->c_str()
+ << " STATIC IMPORT )\n";
break;
case cmTarget::SHARED_LIBRARY:
- fout << "ADD_LIBRARY(" << prefix.c_str() << currentTarget->c_str() << " SHARED IMPORT )\n";
+ fout << "ADD_LIBRARY(" << prefix.c_str() << currentTarget->c_str()
+ << " SHARED IMPORT )\n";
break;
case cmTarget::MODULE_LIBRARY:
- fout << "ADD_LIBRARY(" << prefix.c_str() << currentTarget->c_str() << " MODULE IMPORT )\n";
+ fout << "ADD_LIBRARY(" << prefix.c_str() << currentTarget->c_str()
+ << " MODULE IMPORT )\n";
break;
default: // should never happen
break;
}
- fout << "SET_TARGET_PROPERTIES(" << prefix.c_str() << currentTarget->c_str() << " PROPERTIES \n";
- fout << " LOCATION " << target->GetLocation(0) << "\n";
- for(std::vector<std::string>::const_iterator currentConfig = configurationTypes.begin();
+ fout << "SET_TARGET_PROPERTIES(" << prefix.c_str()
+ << currentTarget->c_str() << " PROPERTIES \n"
+ << " LOCATION " << target->GetLocation(0) << "\n";
+ for(std::vector<std::string>::const_iterator
+ currentConfig = configurationTypes.begin();
currentConfig != configurationTypes.end();
++currentConfig)
{
@@ -139,15 +161,13 @@ bool cmExportCommand
const char* loc = target->GetLocation(currentConfig->c_str());
if (loc && *loc)
{
- fout << " " << currentConfig->c_str()<< "_LOCATION " << loc << "\n";
+ fout << " " << currentConfig->c_str()
+ << "_LOCATION " << loc << "\n";
}
}
}
fout << " )\n\n";
}
- else
- {
- }
}
return true;