[cmake-commits] david.cole committed cmInstallCommand.cxx 1.28 1.29
cmInstallTargetGenerator.cxx 1.45 1.46
cmInstallTargetGenerator.h 1.17 1.18 cmTarget.h 1.90 1.91
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Aug 24 13:30:42 EDT 2007
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv3394/Source
Modified Files:
cmInstallCommand.cxx cmInstallTargetGenerator.cxx
cmInstallTargetGenerator.h cmTarget.h
Log Message:
ENH: Add InstallNameFixupPath to support installing built frameworks on the Mac. Change Application to Applications in the BundleTest. Also correct small typo (tcl->Tcl) noted in bug 4572.
Index: cmInstallTargetGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- cmInstallTargetGenerator.h 2 Jul 2007 18:56:57 -0000 1.17
+++ cmInstallTargetGenerator.h 24 Aug 2007 17:30:40 -0000 1.18
@@ -53,13 +53,13 @@
Indent const& indent);
void AddInstallNamePatchRule(std::ostream& os, Indent const& indent,
const char* config,
- const std::string& toFullPath);
+ const std::string& toDestDirPath);
void AddStripRule(std::ostream& os, Indent const& indent,
cmTarget::TargetType type,
- const std::string& toFullPath);
+ const std::string& toDestDirPath);
void AddRanlibRule(std::ostream& os, Indent const& indent,
cmTarget::TargetType type,
- const std::string& toFullPath);
+ const std::string& toDestDirPath);
cmTarget* Target;
bool ImportLibrary;
Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- cmTarget.h 2 Aug 2007 17:38:39 -0000 1.90
+++ cmTarget.h 24 Aug 2007 17:30:40 -0000 1.91
@@ -137,7 +137,7 @@
*/
std::string GetRuntimeInstallPath() {return this->RuntimeInstallPath;}
void SetRuntimeInstallPath(const char *name) {
- this->RuntimeInstallPath = name;}
+ this->RuntimeInstallPath = name; }
/**
* Get/Set whether there is an install rule for this target.
@@ -145,6 +145,18 @@
bool GetHaveInstallRule() { return this->HaveInstallRule; }
void SetHaveInstallRule(bool h) { this->HaveInstallRule = h; }
+ /**
+ * Get/Set the path needed for calls to install_name_tool regarding this
+ * target. Used to support fixing up installed libraries and executables on
+ * the Mac (including bundles and frameworks). Only used if the target does
+ * not have an INSTALL_NAME_DIR property.
+ * See cmInstallTargetGenerator::AddInstallNamePatchRule and callers for
+ * more information.
+ */
+ std::string GetInstallNameFixupPath() { return this->InstallNameFixupPath; }
+ void SetInstallNameFixupPath(const char *path) {
+ this->InstallNameFixupPath = path; }
+
/** Add a utility on which this project depends. A utility is an executable
* name as would be specified to the ADD_EXECUTABLE or UTILITY_SOURCE
* commands. It is not a full path nor does it have an extension.
@@ -382,6 +394,7 @@
std::vector<std::string> LinkDirectories;
std::vector<std::string> ExplicitLinkDirectories;
bool HaveInstallRule;
+ std::string InstallNameFixupPath;
std::string InstallPath;
std::string RuntimeInstallPath;
std::string OutputDir;
Index: cmInstallTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.cxx,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- cmInstallTargetGenerator.cxx 20 Aug 2007 20:59:06 -0000 1.45
+++ cmInstallTargetGenerator.cxx 24 Aug 2007 17:30:40 -0000 1.46
@@ -154,11 +154,10 @@
Indent const& indent)
{
// Compute the full path to the main installed file for this target.
- std::string toFullPath = "$ENV{DESTDIR}";
- toFullPath += this->Destination;
- toFullPath += "/";
- toFullPath += this->GetInstallFilename(this->Target, config,
- this->ImportLibrary, false);
+ std::string toInstallPath = this->Destination;
+ toInstallPath += "/";
+ toInstallPath += this->GetInstallFilename(this->Target, config,
+ this->ImportLibrary, false);
// Compute the list of files to install for this target.
std::vector<std::string> files;
@@ -198,9 +197,9 @@
type = cmTarget::INSTALL_DIRECTORY;
// Need to apply install_name_tool and stripping to binary
// inside bundle.
- toFullPath += ".app/Contents/MacOS/";
- toFullPath += this->GetInstallFilename(this->Target, config,
- this->ImportLibrary, false);
+ toInstallPath += ".app/Contents/MacOS/";
+ toInstallPath += this->GetInstallFilename(this->Target, config,
+ this->ImportLibrary, false);
literal_args += " USE_SOURCE_PERMISSIONS";
}
else
@@ -234,6 +233,25 @@
// An import library looks like a static library.
type = cmTarget::STATIC_LIBRARY;
}
+ else if(this->Target->GetMakefile()->IsOn("APPLE") &&
+ this->Target->GetPropertyAsBool("FRAMEWORK"))
+ {
+ // Compute the build tree location of the framework directory
+ std::string from1 = fromDirConfig;
+ // Remove trailing slashes
+ cmSystemTools::ConvertToUnixSlashes(from1);
+ files.push_back(from1);
+
+ type = cmTarget::INSTALL_DIRECTORY;
+
+ // Need to apply install_name_tool and stripping to binary
+ // inside framework.
+ toInstallPath += ".framework/";
+ toInstallPath += this->GetInstallFilename(this->Target, config,
+ this->ImportLibrary, false);
+
+ literal_args += " USE_SOURCE_PERMISSIONS";
+ }
else
{
std::string from1 = fromDirConfig;
@@ -266,11 +284,20 @@
no_rename, literal_args.c_str(),
indent);
- os << indent << "IF(EXISTS \"" << toFullPath << "\")\n";
- this->AddInstallNamePatchRule(os, indent.Next(), config, toFullPath);
- this->AddRanlibRule(os, indent.Next(), type, toFullPath);
- this->AddStripRule(os, indent.Next(), type, toFullPath);
- os << indent << "ENDIF(EXISTS \"" << toFullPath << "\")\n";
+ std::string toDestDirPath = "$ENV{DESTDIR}";
+ if(toInstallPath[0] != '/')
+ {
+ toDestDirPath += "/";
+ }
+ toDestDirPath += toInstallPath;
+
+ this->Target->SetInstallNameFixupPath(toInstallPath.c_str());
+
+ os << indent << "IF(EXISTS \"" << toDestDirPath << "\")\n";
+ this->AddInstallNamePatchRule(os, indent.Next(), config, toDestDirPath);
+ this->AddRanlibRule(os, indent.Next(), type, toDestDirPath);
+ this->AddStripRule(os, indent.Next(), type, toDestDirPath);
+ os << indent << "ENDIF(EXISTS \"" << toDestDirPath << "\")\n";
}
//----------------------------------------------------------------------------
@@ -343,7 +370,7 @@
void
cmInstallTargetGenerator
::AddInstallNamePatchRule(std::ostream& os, Indent const& indent,
- const char* config, std::string const& toFullPath)
+ const char* config, std::string const& toDestDirPath)
{
if(this->ImportLibrary ||
!(this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
@@ -354,9 +381,9 @@
}
// Fix the install_name settings in installed binaries.
- std::string installNameTool =
+ std::string installNameTool =
this->Target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_NAME_TOOL");
-
+
if(!installNameTool.size())
{
return;
@@ -393,16 +420,24 @@
std::string for_build = tgt->GetInstallNameDirForBuildTree(config);
std::string for_install =
tgt->GetInstallNameDirForInstallTree(config);
- if(for_build != for_install)
- {
- std::string fname =
- this->GetInstallFilename(tgt, config, false, true);
- // Map from the build-tree install_name.
- for_build += fname;
+ std::string fname =
+ this->GetInstallFilename(tgt, config, false, true);
- // Map to the install-tree install_name.
+ // Map from the build-tree install_name.
+ for_build += fname;
+
+ // Map to the install-tree install_name.
+ if (!for_install.empty())
+ {
for_install += fname;
+ }
+ else
+ {
+ for_install = tgt->GetInstallNameFixupPath();
+ }
+ if(for_build != for_install)
+ {
// Store the mapping entry.
install_name_remap[for_build] = for_install;
}
@@ -419,12 +454,22 @@
this->Target->GetInstallNameDirForBuildTree(config);
std::string for_install =
this->Target->GetInstallNameDirForInstallTree(config);
+ std::string fname =
+ this->GetInstallFilename(this->Target, config, this->ImportLibrary,
+ true);
+ for_build += fname;
+ if (!for_install.empty())
+ {
+ for_install += fname;
+ }
+ else
+ {
+ for_install = this->Target->GetInstallNameFixupPath();
+ }
if(for_build != for_install)
{
// Prepare to refer to the install-tree install_name.
new_id = for_install;
- new_id += this->GetInstallFilename(this->Target, config,
- this->ImportLibrary, true);
}
}
@@ -445,7 +490,7 @@
os << "\n" << indent << " -change \""
<< i->first << "\" \"" << i->second << "\"";
}
- os << "\n" << indent << " \"" << toFullPath << "\")\n";
+ os << "\n" << indent << " \"" << toDestDirPath << "\")\n";
}
}
@@ -454,7 +499,7 @@
cmInstallTargetGenerator::AddStripRule(std::ostream& os,
Indent const& indent,
cmTarget::TargetType type,
- const std::string& toFullPath)
+ const std::string& toDestDirPath)
{
// don't strip static libraries, because it removes the only symbol table
@@ -479,7 +524,7 @@
os << indent << "IF(CMAKE_INSTALL_DO_STRIP)\n";
os << indent << " EXECUTE_PROCESS(COMMAND \""
<< this->Target->GetMakefile()->GetDefinition("CMAKE_STRIP")
- << "\" \"" << toFullPath << "\")\n";
+ << "\" \"" << toDestDirPath << "\")\n";
os << indent << "ENDIF(CMAKE_INSTALL_DO_STRIP)\n";
}
@@ -488,7 +533,7 @@
cmInstallTargetGenerator::AddRanlibRule(std::ostream& os,
Indent const& indent,
cmTarget::TargetType type,
- const std::string& toFullPath)
+ const std::string& toDestDirPath)
{
// Static libraries need ranlib on this platform.
if(type != cmTarget::STATIC_LIBRARY)
@@ -511,5 +556,5 @@
}
os << indent << "EXECUTE_PROCESS(COMMAND \""
- << ranlib << "\" \"" << toFullPath << "\")\n";
+ << ranlib << "\" \"" << toDestDirPath << "\")\n";
}
Index: cmInstallCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallCommand.cxx,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- cmInstallCommand.cxx 24 Aug 2007 12:55:20 -0000 1.28
+++ cmInstallCommand.cxx 24 Aug 2007 17:30:40 -0000 1.29
@@ -181,6 +181,7 @@
targetList.Follows(0);
genericArgs.ArgumentGroup.Follows(&targetList);
genericArgs.Parse(&genericArgVector.GetVector(), &unknownArgs);
+ bool success = genericArgs.Finalize();
cmInstallCommandArguments archiveArgs;
cmInstallCommandArguments libraryArgs;
@@ -219,7 +220,7 @@
publicHeaderArgs.SetGenericArguments(&genericArgs);
privateHeaderArgs.SetGenericArguments(&genericArgs);
- bool success = archiveArgs.Finalize();
+ success = success && archiveArgs.Finalize();
success = success && libraryArgs.Finalize();
success = success && runtimeArgs.Finalize();
success = success && frameworkArgs.Finalize();
More information about the Cmake-commits
mailing list