[cmake-commits] alex committed cmAddExecutableCommand.cxx 1.29
1.29.6.1 cmGlobalUnixMakefileGenerator3.cxx 1.106 1.106.2.1
cmIncludeExternalMSProjectCommand.cxx 1.18 1.18.6.1
cmLocalUnixMakefileGenerator3.cxx 1.205 1.205.2.1
cmMakefile.cxx 1.386 1.386.2.1 cmMakefile.h 1.200 1.200.6.1
cmMakefileTargetGenerator.cxx 1.62 1.62.4.1 cmTarget.cxx 1.137
1.137.2.1 cmTarget.h 1.82 1.82.2.1
cmake-commits at cmake.org
cmake-commits at cmake.org
Wed May 9 11:45:00 EDT 2007
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv12872/Source
Modified Files:
Tag: CMake-ImportTargets
cmAddExecutableCommand.cxx cmGlobalUnixMakefileGenerator3.cxx
cmIncludeExternalMSProjectCommand.cxx
cmLocalUnixMakefileGenerator3.cxx cmMakefile.cxx cmMakefile.h
cmMakefileTargetGenerator.cxx cmTarget.cxx cmTarget.h
Log Message:
ENH: initial try for support for "importing" targets into cmake, so e.g. the support
for libs in release- and debug mode can be done much better and importeed
executable targets can be used in custom commands (-> cross compiling)
Alex
Index: cmGlobalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalUnixMakefileGenerator3.cxx,v
retrieving revision 1.106
retrieving revision 1.106.2.1
diff -u -d -r1.106 -r1.106.2.1
--- cmGlobalUnixMakefileGenerator3.cxx 9 May 2007 12:25:45 -0000 1.106
+++ cmGlobalUnixMakefileGenerator3.cxx 9 May 2007 15:44:58 -0000 1.106.2.1
@@ -641,51 +641,51 @@
// simple name)
if(t->second.GetName() &&
strlen(t->second.GetName()) &&
- emitted.insert(t->second.GetName()).second)
+ emitted.insert(t->second.GetName()).second &&
+ // don't emit rules for imported targets
+ (t->second.GetPropertyAsBool("IMPORTED") == false) &&
+ // Handle user targets here. Global targets are handled in
+ // the local generator on a per-directory basis.
+ ((t->second.GetType() == cmTarget::EXECUTABLE) ||
+ (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
+ (t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
+ (t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
+ (t->second.GetType() == cmTarget::UTILITY)))
{
- // Handle user targets here. Global targets are handled in
- // the local generator on a per-directory basis.
- if((t->second.GetType() == cmTarget::EXECUTABLE) ||
- (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
- (t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
- (t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
- (t->second.GetType() == cmTarget::UTILITY))
- {
- // Add a rule to build the target by name.
- lg->WriteDivider(ruleFileStream);
- ruleFileStream
- << "# Target rules for targets named "
- << t->second.GetName() << "\n\n";
-
- // Write the rule.
- commands.clear();
- std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
- tmp += "Makefile2";
- commands.push_back(lg->GetRecursiveMakeCall
- (tmp.c_str(),t->second.GetName()));
- depends.clear();
- depends.push_back("cmake_check_build_system");
- lg->WriteMakeRule(ruleFileStream,
- "Build rule for target.",
- t->second.GetName(), depends, commands,
- true);
-
- // Add a fast rule to build the target
- std::string localName = lg->GetRelativeTargetDirectory(t->second);
- std::string makefileName;
- makefileName = localName;
- makefileName += "/build.make";
- depends.clear();
- commands.clear();
- std::string makeTargetName = localName;
- makeTargetName += "/build";
- localName = t->second.GetName();
- localName += "/fast";
- commands.push_back(lg->GetRecursiveMakeCall
- (makefileName.c_str(), makeTargetName.c_str()));
- lg->WriteMakeRule(ruleFileStream, "fast build rule for target.",
- localName.c_str(), depends, commands, true);
- }
+ // Add a rule to build the target by name.
+ lg->WriteDivider(ruleFileStream);
+ ruleFileStream
+ << "# Target rules for targets named "
+ << t->second.GetName() << "\n\n";
+
+ // Write the rule.
+ commands.clear();
+ std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
+ tmp += "Makefile2";
+ commands.push_back(lg->GetRecursiveMakeCall
+ (tmp.c_str(),t->second.GetName()));
+ depends.clear();
+ depends.push_back("cmake_check_build_system");
+ lg->WriteMakeRule(ruleFileStream,
+ "Build rule for target.",
+ t->second.GetName(), depends, commands,
+ true);
+
+ // Add a fast rule to build the target
+ std::string localName = lg->GetRelativeTargetDirectory(t->second);
+ std::string makefileName;
+ makefileName = localName;
+ makefileName += "/build.make";
+ depends.clear();
+ commands.clear();
+ std::string makeTargetName = localName;
+ makeTargetName += "/build";
+ localName = t->second.GetName();
+ localName += "/fast";
+ commands.push_back(lg->GetRecursiveMakeCall
+ (makefileName.c_str(), makeTargetName.c_str()));
+ lg->WriteMakeRule(ruleFileStream, "fast build rule for target.",
+ localName.c_str(), depends, commands, true);
}
}
}
@@ -714,7 +714,14 @@
cmTargets& targets = lg->GetMakefile()->GetTargets();
for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
{
- if (t->second.GetName() && strlen(t->second.GetName()))
+ if (t->second.GetName()
+ && strlen(t->second.GetName())
+ && (t->second.GetPropertyAsBool("IMPORTED") == false)
+ && ((t->second.GetType() == cmTarget::EXECUTABLE)
+ || (t->second.GetType() == cmTarget::STATIC_LIBRARY)
+ || (t->second.GetType() == cmTarget::SHARED_LIBRARY)
+ || (t->second.GetType() == cmTarget::MODULE_LIBRARY)
+ || (t->second.GetType() == cmTarget::UTILITY)))
{
std::string makefileName;
// Add a rule to build the target by name.
@@ -722,165 +729,158 @@
makefileName = localName;
makefileName += "/build.make";
- if (((t->second.GetType() == cmTarget::EXECUTABLE) ||
- (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
- (t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
- (t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
- (t->second.GetType() == cmTarget::UTILITY)))
+ bool needRequiresStep =
+ this->NeedRequiresStep(lg,t->second.GetName());
+
+ lg->WriteDivider(ruleFileStream);
+ ruleFileStream
+ << "# Target rules for target "
+ << localName << "\n\n";
+
+ commands.clear();
+ if (t->second.GetType() != cmTarget::UTILITY)
{
- bool needRequiresStep =
- this->NeedRequiresStep(lg,t->second.GetName());
+ makeTargetName = localName;
+ makeTargetName += "/depend";
+ commands.push_back(lg->GetRecursiveMakeCall
+ (makefileName.c_str(),makeTargetName.c_str()));
- lg->WriteDivider(ruleFileStream);
- ruleFileStream
- << "# Target rules for target "
- << localName << "\n\n";
-
- commands.clear();
- if (t->second.GetType() != cmTarget::UTILITY)
+ // add requires if we need it for this generator
+ if (needRequiresStep)
{
makeTargetName = localName;
- makeTargetName += "/depend";
+ makeTargetName += "/requires";
commands.push_back(lg->GetRecursiveMakeCall
- (makefileName.c_str(),makeTargetName.c_str()));
-
- // add requires if we need it for this generator
- if (needRequiresStep)
- {
- makeTargetName = localName;
- makeTargetName += "/requires";
- commands.push_back(lg->GetRecursiveMakeCall
- (makefileName.c_str(),makeTargetName.c_str()));
- }
+ (makefileName.c_str(),makeTargetName.c_str()));
}
- makeTargetName = localName;
- makeTargetName += "/build";
- commands.push_back(lg->GetRecursiveMakeCall
- (makefileName.c_str(),makeTargetName.c_str()));
-
- // Write the rule.
- localName += "/all";
- depends.clear();
+ }
+ makeTargetName = localName;
+ makeTargetName += "/build";
+ commands.push_back(lg->GetRecursiveMakeCall
+ (makefileName.c_str(),makeTargetName.c_str()));
+
+ // Write the rule.
+ localName += "/all";
+ depends.clear();
- std::string progressDir =
- lg->GetMakefile()->GetHomeOutputDirectory();
- progressDir += cmake::GetCMakeFilesDirectory();
- {
- cmOStringStream progCmd;
- progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report ";
- // all target counts
- progCmd << lg->Convert(progressDir.c_str(),
- cmLocalGenerator::FULL,
- cmLocalGenerator::SHELL);
- progCmd << " ";
- std::vector<int> &progFiles = lg->ProgressFiles[t->first];
- for (std::vector<int>::iterator i = progFiles.begin();
- i != progFiles.end(); ++i)
- {
- progCmd << " " << *i;
- }
- commands.push_back(progCmd.str());
- }
- progressDir = "Built target ";
- progressDir += t->first;
- lg->AppendEcho(commands,progressDir.c_str());
-
- this->AppendGlobalTargetDepends(depends,t->second);
- lg->WriteMakeRule(ruleFileStream, "All Build rule for target.",
- localName.c_str(), depends, commands, true);
-
- // add the all/all dependency
- if (!exclude && !t->second.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
- {
- depends.clear();
- depends.push_back(localName);
- commands.clear();
- lg->WriteMakeRule(ruleFileStream, "Include target in all.",
- "all", depends, commands, true);
- }
-
- // Write the rule.
- commands.clear();
- progressDir = lg->GetMakefile()->GetHomeOutputDirectory();
- progressDir += cmake::GetCMakeFilesDirectory();
-
+ std::string progressDir =
+ lg->GetMakefile()->GetHomeOutputDirectory();
+ progressDir += cmake::GetCMakeFilesDirectory();
{
- // TODO: Convert the total progress count to a make variable.
cmOStringStream progCmd;
- progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start ";
- // # in target
+ progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report ";
+ // all target counts
progCmd << lg->Convert(progressDir.c_str(),
- cmLocalGenerator::FULL,
- cmLocalGenerator::SHELL);
- //
- std::set<cmStdString> emitted;
- progCmd << " "
- << this->GetTargetTotalNumberOfActions(t->second,
- emitted);
+ cmLocalGenerator::FULL,
+ cmLocalGenerator::SHELL);
+ progCmd << " ";
+ std::vector<int> &progFiles = lg->ProgressFiles[t->first];
+ for (std::vector<int>::iterator i = progFiles.begin();
+ i != progFiles.end(); ++i)
+ {
+ progCmd << " " << *i;
+ }
commands.push_back(progCmd.str());
}
- std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
- tmp += "Makefile2";
- commands.push_back(lg->GetRecursiveMakeCall
- (tmp.c_str(),localName.c_str()));
+ progressDir = "Built target ";
+ progressDir += t->first;
+ lg->AppendEcho(commands,progressDir.c_str());
+
+ this->AppendGlobalTargetDepends(depends,t->second);
+ lg->WriteMakeRule(ruleFileStream, "All Build rule for target.",
+ localName.c_str(), depends, commands, true);
+
+ // add the all/all dependency
+ if (!exclude && !t->second.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
{
- cmOStringStream progCmd;
- progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
- progCmd << lg->Convert(progressDir.c_str(),
- cmLocalGenerator::FULL,
- cmLocalGenerator::SHELL);
- progCmd << " 0";
- commands.push_back(progCmd.str());
- }
- depends.clear();
- depends.push_back("cmake_check_build_system");
- localName = lg->GetRelativeTargetDirectory(t->second);
- localName += "/rule";
- lg->WriteMakeRule(ruleFileStream,
- "Build rule for subdir invocation for target.",
- localName.c_str(), depends, commands, true);
-
- // Add a target with the canonical name (no prefix, suffix or path).
- commands.clear();
depends.clear();
depends.push_back(localName);
- lg->WriteMakeRule(ruleFileStream, "Convenience name for target.",
- t->second.GetName(), depends, commands, true);
-
- // Add rules to prepare the target for installation.
- if(t->second.NeedRelinkBeforeInstall())
- {
- localName = lg->GetRelativeTargetDirectory(t->second);
- localName += "/preinstall";
- depends.clear();
- commands.clear();
- commands.push_back(lg->GetRecursiveMakeCall
- (makefileName.c_str(), localName.c_str()));
- lg->WriteMakeRule(ruleFileStream,
- "Pre-install relink rule for target.",
- localName.c_str(), depends, commands, true);
- depends.clear();
- depends.push_back(localName);
- commands.clear();
- lg->WriteMakeRule(ruleFileStream, "Prepare target for install.",
- "preinstall", depends, commands, true);
- }
-
- // add the clean rule
+ commands.clear();
+ lg->WriteMakeRule(ruleFileStream, "Include target in all.",
+ "all", depends, commands, true);
+ }
+
+ // Write the rule.
+ commands.clear();
+ progressDir = lg->GetMakefile()->GetHomeOutputDirectory();
+ progressDir += cmake::GetCMakeFilesDirectory();
+
+ {
+ // TODO: Convert the total progress count to a make variable.
+ cmOStringStream progCmd;
+ progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start ";
+ // # in target
+ progCmd << lg->Convert(progressDir.c_str(),
+ cmLocalGenerator::FULL,
+ cmLocalGenerator::SHELL);
+ //
+ std::set<cmStdString> emitted;
+ progCmd << " "
+ << this->GetTargetTotalNumberOfActions(t->second,
+ emitted);
+ commands.push_back(progCmd.str());
+ }
+ std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
+ tmp += "Makefile2";
+ commands.push_back(lg->GetRecursiveMakeCall
+ (tmp.c_str(),localName.c_str()));
+ {
+ cmOStringStream progCmd;
+ progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
+ progCmd << lg->Convert(progressDir.c_str(),
+ cmLocalGenerator::FULL,
+ cmLocalGenerator::SHELL);
+ progCmd << " 0";
+ commands.push_back(progCmd.str());
+ }
+ depends.clear();
+ depends.push_back("cmake_check_build_system");
+ localName = lg->GetRelativeTargetDirectory(t->second);
+ localName += "/rule";
+ lg->WriteMakeRule(ruleFileStream,
+ "Build rule for subdir invocation for target.",
+ localName.c_str(), depends, commands, true);
+
+ // Add a target with the canonical name (no prefix, suffix or path).
+ commands.clear();
+ depends.clear();
+ depends.push_back(localName);
+ lg->WriteMakeRule(ruleFileStream, "Convenience name for target.",
+ t->second.GetName(), depends, commands, true);
+
+ // Add rules to prepare the target for installation.
+ if(t->second.NeedRelinkBeforeInstall())
+ {
localName = lg->GetRelativeTargetDirectory(t->second);
- makeTargetName = localName;
- makeTargetName += "/clean";
+ localName += "/preinstall";
depends.clear();
commands.clear();
commands.push_back(lg->GetRecursiveMakeCall
- (makefileName.c_str(), makeTargetName.c_str()));
- lg->WriteMakeRule(ruleFileStream, "clean rule for target.",
- makeTargetName.c_str(), depends, commands, true);
+ (makefileName.c_str(), localName.c_str()));
+ lg->WriteMakeRule(ruleFileStream,
+ "Pre-install relink rule for target.",
+ localName.c_str(), depends, commands, true);
+ depends.clear();
+ depends.push_back(localName);
commands.clear();
- depends.push_back(makeTargetName);
- lg->WriteMakeRule(ruleFileStream, "clean rule for target.",
- "clean", depends, commands, true);
+ lg->WriteMakeRule(ruleFileStream, "Prepare target for install.",
+ "preinstall", depends, commands, true);
}
+
+ // add the clean rule
+ localName = lg->GetRelativeTargetDirectory(t->second);
+ makeTargetName = localName;
+ makeTargetName += "/clean";
+ depends.clear();
+ commands.clear();
+ commands.push_back(lg->GetRecursiveMakeCall
+ (makefileName.c_str(), makeTargetName.c_str()));
+ lg->WriteMakeRule(ruleFileStream, "clean rule for target.",
+ makeTargetName.c_str(), depends, commands, true);
+ commands.clear();
+ depends.push_back(makeTargetName);
+ lg->WriteMakeRule(ruleFileStream, "clean rule for target.",
+ "clean", depends, commands, true);
}
}
}
Index: cmMakefile.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.h,v
retrieving revision 1.200
retrieving revision 1.200.6.1
diff -u -d -r1.200 -r1.200.6.1
--- cmMakefile.h 13 Mar 2007 19:18:27 -0000 1.200
+++ cmMakefile.h 9 May 2007 15:44:58 -0000 1.200.6.1
@@ -165,6 +165,8 @@
void AddDefineFlag(const char* definition);
void RemoveDefineFlag(const char* definition);
+ cmTarget* AddNewTarget(cmTarget::TargetType type, const char* name);
+
/**
* Add an executable to the build.
*/
Index: cmIncludeExternalMSProjectCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmIncludeExternalMSProjectCommand.cxx,v
retrieving revision 1.18
retrieving revision 1.18.6.1
diff -u -d -r1.18 -r1.18.6.1
--- cmIncludeExternalMSProjectCommand.cxx 12 Mar 2007 14:26:59 -0000 1.18
+++ cmIncludeExternalMSProjectCommand.cxx 9 May 2007 15:44:58 -0000 1.18.6.1
@@ -53,7 +53,6 @@
cmTarget target;
target.SetType(cmTarget::UTILITY, utility_name.c_str());
target.SetProperty("EXCLUDE_FROM_ALL","FALSE");
- target.SetMakefile(this->Makefile);
std::vector<std::string> no_outputs;
cmCustomCommandLines commandLines;
cmCustomCommandLine commandLine;
@@ -64,10 +63,7 @@
target.GetPostBuildCommands().push_back(cc);
// Add the target to the set of targets.
- cmTargets::iterator it =
- this->Makefile->GetTargets()
- .insert(cmTargets::value_type(utility_name.c_str(),target)).first;
- this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->AddTarget(*it);
+ this->Makefile->AddTarget(target);
}
#endif
return true;
Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.82
retrieving revision 1.82.2.1
diff -u -d -r1.82 -r1.82.2.1
--- cmTarget.h 9 May 2007 13:35:59 -0000 1.82
+++ cmTarget.h 9 May 2007 15:44:58 -0000 1.82.2.1
@@ -44,7 +44,7 @@
/**
* Return the type of target.
*/
- TargetType GetType()
+ TargetType GetType() const
{
return this->TargetTypeValue;
}
Index: cmLocalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v
retrieving revision 1.205
retrieving revision 1.205.2.1
diff -u -d -r1.205 -r1.205.2.1
--- cmLocalUnixMakefileGenerator3.cxx 9 May 2007 12:25:45 -0000 1.205
+++ cmLocalUnixMakefileGenerator3.cxx 9 May 2007 15:44:58 -0000 1.205.2.1
@@ -113,7 +113,6 @@
if (tg)
{
this->TargetGenerators.push_back(tg);
-// t->second.TraceVSDependencies(empty, this->Makefile);
tg->WriteRuleFiles();
}
}
@@ -339,11 +338,12 @@
std::string localName;
for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
{
- if((t->second.GetType() == cmTarget::EXECUTABLE) ||
- (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
- (t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
- (t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
- (t->second.GetType() == cmTarget::UTILITY))
+ if ((t->second.GetPropertyAsBool("IMPORTED")==false) &&
+ ((t->second.GetType() == cmTarget::EXECUTABLE) ||
+ (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
+ (t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
+ (t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
+ (t->second.GetType() == cmTarget::UTILITY)))
{
emitted.insert(t->second.GetName());
Index: cmMakefileTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.cxx,v
retrieving revision 1.62
retrieving revision 1.62.4.1
diff -u -d -r1.62 -r1.62.4.1
--- cmMakefileTargetGenerator.cxx 1 May 2007 17:51:25 -0000 1.62
+++ cmMakefileTargetGenerator.cxx 9 May 2007 15:44:58 -0000 1.62.4.1
@@ -44,6 +44,11 @@
{
cmMakefileTargetGenerator *result = 0;
+ if (tgt->GetPropertyAsBool("IMPORTED") == true)
+ {
+ return result;
+ }
+
switch (tgt->GetType())
{
case cmTarget::EXECUTABLE:
Index: cmAddExecutableCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmAddExecutableCommand.cxx,v
retrieving revision 1.29
retrieving revision 1.29.6.1
diff -u -d -r1.29 -r1.29.6.1
--- cmAddExecutableCommand.cxx 12 Mar 2007 14:26:59 -0000 1.29
+++ cmAddExecutableCommand.cxx 9 May 2007 15:44:58 -0000 1.29.6.1
@@ -32,6 +32,7 @@
bool use_win32 = false;
bool use_macbundle = false;
bool excludeFromAll = false;
+ bool importTarget = false;
while ( s != args.end() )
{
if (*s == "WIN32")
@@ -49,11 +50,23 @@
++s;
excludeFromAll = true;
}
+ else if(*s == "IMPORT")
+ {
+ ++s;
+ importTarget = true;
+ }
else
{
break;
}
}
+
+ if (importTarget)
+ {
+ cmTarget* target = this->Makefile->AddNewTarget(cmTarget::EXECUTABLE, exename.c_str());
+ target->SetProperty("IMPORTED","TRUE");
+ return true;
+ }
if (s == args.end())
{
Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.137
retrieving revision 1.137.2.1
diff -u -d -r1.137 -r1.137.2.1
--- cmTarget.cxx 9 May 2007 13:35:59 -0000 1.137
+++ cmTarget.cxx 9 May 2007 15:44:58 -0000 1.137.2.1
@@ -576,7 +576,9 @@
// see if we can find a target with this name
cmTarget* t = this->Makefile->GetLocalGenerator()->
GetGlobalGenerator()->FindTarget(0, currentCommand.c_str());
- if (( t) && (t->GetType()==cmTarget::EXECUTABLE))
+ if (( t)
+ && (t->GetType()==cmTarget::EXECUTABLE)
+ && (t->GetPropertyAsBool("IMPORTED") == false))
{
automaticTargetDepends.push_back(currentCommand);
}
@@ -1234,6 +1236,12 @@
const char* cmTarget::GetLocation(const char* config)
{
+ // TODO this is just to make it work somehow
+ if (this->GetPropertyAsBool("IMPORTED"))
+ {
+ return this->GetProperty("IMPORTLOCATION");
+ }
+
this->Location = this->GetDirectory();
if(!this->Location.empty())
{
Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.386
retrieving revision 1.386.2.1
diff -u -d -r1.386 -r1.386.2.1
--- cmMakefile.cxx 9 May 2007 12:25:45 -0000 1.386
+++ cmMakefile.cxx 9 May 2007 15:44:58 -0000 1.386.2.1
@@ -817,12 +817,10 @@
bool escapeOldStyle, const char* comment)
{
// Create a target instance for this utility.
- cmTarget target;
- target.SetMakefile(this);
- target.SetType(cmTarget::UTILITY, utilityName);
+ cmTarget* target = this->AddNewTarget(cmTarget::UTILITY, utilityName);
if (excludeFromAll)
{
- target.SetProperty("EXCLUDE_FROM_ALL", "TRUE");
+ target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
}
if(!comment)
{
@@ -842,7 +840,7 @@
commandLines, comment,
workingDirectory, no_replace,
escapeOldStyle);
- target.GetSourceLists().push_back(force);
+ target->GetSourceLists().push_back(force);
// The output is not actually created so mark it symbolic.
if(cmSourceFile* sf = this->GetSource(force.c_str()))
@@ -854,11 +852,6 @@
cmSystemTools::Error("Could not get source file entry for ",
force.c_str());
}
-
- // Add the target to the set of targets.
- cmTargets::iterator it =
- this->Targets.insert(cmTargets::value_type(utilityName,target)).first;
- this->LocalGenerator->GetGlobalGenerator()->AddTarget(*it);
}
void cmMakefile::AddDefineFlag(const char* flag)
@@ -1335,53 +1328,56 @@
const std::vector<std::string> &srcs,
bool excludeFromAll)
{
- cmTarget target;
+ cmTarget* target=0;
switch (shared)
{
case 0:
- target.SetType(cmTarget::STATIC_LIBRARY, lname);
+ target=this->AddNewTarget(cmTarget::STATIC_LIBRARY, lname);
break;
case 1:
- target.SetType(cmTarget::SHARED_LIBRARY, lname);
+ target=this->AddNewTarget(cmTarget::SHARED_LIBRARY, lname);
break;
case 2:
- target.SetType(cmTarget::MODULE_LIBRARY, lname);
+ target=this->AddNewTarget(cmTarget::MODULE_LIBRARY, lname);
break;
default:
- target.SetType(cmTarget::STATIC_LIBRARY, lname);
+ target=this->AddNewTarget(cmTarget::STATIC_LIBRARY, lname);
}
- target.SetMakefile(this);
// Clear its dependencies. Otherwise, dependencies might persist
// over changes in CMakeLists.txt, making the information stale and
// hence useless.
- target.ClearDependencyInformation( *this, lname );
+ target->ClearDependencyInformation( *this, lname );
if(excludeFromAll)
{
- target.SetProperty("EXCLUDE_FROM_ALL", "TRUE");
+ target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
}
- target.GetSourceLists() = srcs;
- this->AddGlobalLinkInformation(lname, target);
- cmTargets::iterator it =
- this->Targets.insert(cmTargets::value_type(lname,target)).first;
- this->LocalGenerator->GetGlobalGenerator()->AddTarget(*it);
+ target->GetSourceLists() = srcs;
+ this->AddGlobalLinkInformation(lname, *target);
}
cmTarget* cmMakefile::AddExecutable(const char *exeName,
const std::vector<std::string> &srcs,
bool excludeFromAll)
{
- cmTarget target;
- target.SetType(cmTarget::EXECUTABLE, exeName);
- target.SetMakefile(this);
+ cmTarget* target = this->AddNewTarget(cmTarget::EXECUTABLE, exeName);
if(excludeFromAll)
{
- target.SetProperty("EXCLUDE_FROM_ALL", "TRUE");
+ target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
}
- target.GetSourceLists() = srcs;
- this->AddGlobalLinkInformation(exeName, target);
+ target->GetSourceLists() = srcs;
+ this->AddGlobalLinkInformation(exeName, *target);
+ return target;
+}
+
+
+cmTarget* cmMakefile::AddNewTarget(cmTarget::TargetType type, const char* name)
+{
+ cmTarget target;
+ target.SetType(type, name);
+ target.SetMakefile(this);
cmTargets::iterator it =
- this->Targets.insert(cmTargets::value_type(exeName,target)).first;
+ this->Targets.insert(cmTargets::value_type(target.GetName(), target)).first;
this->LocalGenerator->GetGlobalGenerator()->AddTarget(*it);
return &it->second;
}
More information about the Cmake-commits
mailing list