[cmake-commits] king committed cmGlobalUnixMakefileGenerator3.cxx
1.114 1.115 cmInstallCommand.h 1.19 1.20
cmInstallTargetGenerator.cxx 1.43 1.44
cmLocalUnixMakefileGenerator3.cxx 1.213 1.214 cmTarget.cxx 1.160 1.161
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Aug 3 16:31:10 EDT 2007
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv23847
Modified Files:
cmGlobalUnixMakefileGenerator3.cxx cmInstallCommand.h
cmInstallTargetGenerator.cxx cmLocalUnixMakefileGenerator3.cxx
cmTarget.cxx
Log Message:
ENH: Added warning when an install rule is created from an EXCLUDE_FROM_ALL target. Added a foo/preinstall version of targets that need relinking so that exclude-from-all targets can be manually relinked for installation.
Index: cmGlobalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalUnixMakefileGenerator3.cxx,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -d -r1.114 -r1.115
--- cmGlobalUnixMakefileGenerator3.cxx 3 Aug 2007 19:44:25 -0000 1.114
+++ cmGlobalUnixMakefileGenerator3.cxx 3 Aug 2007 20:31:08 -0000 1.115
@@ -539,7 +539,7 @@
this->WriteDirectoryRule2(ruleFileStream, lg, "clean", false, false);
// Write directory-level rules for "preinstall".
- this->WriteDirectoryRule2(ruleFileStream, lg, "preinstall", false, true);
+ this->WriteDirectoryRule2(ruleFileStream, lg, "preinstall", true, true);
}
@@ -677,6 +677,23 @@
(makefileName.c_str(), makeTargetName.c_str()));
lg->WriteMakeRule(ruleFileStream, "fast build rule for target.",
localName.c_str(), depends, commands, true);
+
+ // Add a local name for the rule to relink the target before
+ // installation.
+ if(t->second.NeedRelinkBeforeInstall())
+ {
+ makeTargetName = lg->GetRelativeTargetDirectory(t->second);
+ makeTargetName += "/preinstall";
+ localName = t->second.GetName();
+ localName += "/preinstall";
+ depends.clear();
+ commands.clear();
+ commands.push_back(lg->GetRecursiveMakeCall
+ (makefileName.c_str(), makeTargetName.c_str()));
+ lg->WriteMakeRule(ruleFileStream,
+ "Manual pre-install relink rule for target.",
+ localName.c_str(), depends, commands, true);
+ }
}
}
}
Index: cmInstallCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallCommand.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- cmInstallCommand.h 19 Jun 2007 17:10:21 -0000 1.19
+++ cmInstallCommand.h 3 Aug 2007 20:31:08 -0000 1.20
@@ -144,6 +144,9 @@
"On non-DLL platforms mySharedLib will be installed to <prefix>/lib "
"and /some/full/path."
"\n"
+ "Installing a target with EXCLUDE_FROM_ALL set to true has "
+ "undefined behavior."
+ "\n"
"The FILES signature:\n"
" INSTALL(FILES files... DESTINATION <dir>\n"
" [PERMISSIONS permissions...]\n"
Index: cmLocalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v
retrieving revision 1.213
retrieving revision 1.214
diff -u -d -r1.213 -r1.214
--- cmLocalUnixMakefileGenerator3.cxx 1 Aug 2007 19:25:40 -0000 1.213
+++ cmLocalUnixMakefileGenerator3.cxx 3 Aug 2007 20:31:08 -0000 1.214
@@ -353,10 +353,10 @@
depends.clear();
// Build the target for this pass.
- std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
- tmp += "Makefile2";
+ std::string makefile2 = cmake::GetCMakeFilesDirectoryPostSlash();
+ makefile2 += "Makefile2";
commands.push_back(this->GetRecursiveMakeCall
- (tmp.c_str(),localName.c_str()));
+ (makefile2.c_str(),localName.c_str()));
this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(),
this->Makefile->GetStartOutputDirectory());
@@ -390,6 +390,26 @@
this->Makefile->GetStartOutputDirectory());
this->WriteMakeRule(ruleFileStream, "fast build rule for target.",
localName.c_str(), depends, commands, true);
+
+ // Add a local name for the rule to relink the target before
+ // installation.
+ if(t->second.NeedRelinkBeforeInstall())
+ {
+ makeTargetName = this->GetRelativeTargetDirectory(t->second);
+ makeTargetName += "/preinstall";
+ localName = t->second.GetName();
+ localName += "/preinstall";
+ depends.clear();
+ commands.clear();
+ commands.push_back(this->GetRecursiveMakeCall
+ (makefile2.c_str(), makeTargetName.c_str()));
+ this->CreateCDCommand(commands,
+ this->Makefile->GetHomeOutputDirectory(),
+ this->Makefile->GetStartOutputDirectory());
+ this->WriteMakeRule(ruleFileStream,
+ "Manual pre-install relink rule for target.",
+ localName.c_str(), depends, commands, true);
+ }
}
}
}
Index: cmInstallTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.cxx,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- cmInstallTargetGenerator.cxx 2 Jul 2007 20:04:12 -0000 1.43
+++ cmInstallTargetGenerator.cxx 3 Aug 2007 20:31:08 -0000 1.44
@@ -45,6 +45,17 @@
//----------------------------------------------------------------------------
void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
{
+ // Warn if installing an exclude-from-all target.
+ if(this->Target->GetPropertyAsBool("EXCLUDE_FROM_ALL"))
+ {
+ cmOStringStream msg;
+ msg << "WARNING: Target \"" << this->Target->GetName()
+ << "\" has EXCLUDE_FROM_ALL set and will not be built by default "
+ << "but an install rule has been provided for it. CMake does "
+ << "not define behavior for this case.";
+ cmSystemTools::Message(msg.str().c_str(), "Warning");
+ }
+
// Track indentation.
Indent indent;
Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -d -r1.160 -r1.161
--- cmTarget.cxx 3 Aug 2007 19:44:25 -0000 1.160
+++ cmTarget.cxx 3 Aug 2007 20:31:08 -0000 1.161
@@ -123,8 +123,9 @@
"A property on a target that indicates if the target is excluded "
"from the default build target. If it is not, then with a Makefile "
"for example typing make will cause this target to be built. "
- "The same concept applies to the default build of other generators.",
- false);
+ "The same concept applies to the default build of other generators. "
+ "Installing a target with EXCLUDE_FROM_ALL set to true has "
+ "undefined behavior.");
cm->DefineProperty
("INSTALL_NAME_DIR", cmProperty::TARGET,
More information about the Cmake-commits
mailing list