[Cmake-commits] CMake branch, next, updated. v2.8.10.2-2420-g6549dc0
Brad King
brad.king at kitware.com
Fri Mar 8 09:59:48 EST 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 6549dc029e5e7a9ff6dc4134573eaa03bf8f1f70 (commit)
via 0c727b906ac943583fcfb1eb5cf3ea92d2ea030c (commit)
from 56db42bc5ffd642d83dd8dbba4bfc87e2899fe0f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6549dc029e5e7a9ff6dc4134573eaa03bf8f1f70
commit 6549dc029e5e7a9ff6dc4134573eaa03bf8f1f70
Merge: 56db42b 0c727b9
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Mar 8 09:59:37 2013 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Mar 8 09:59:37 2013 -0500
Merge topic 'install-export-usr-move' into next
0c727b9 install(EXPORT): Force absolute paths for usr-move
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0c727b906ac943583fcfb1eb5cf3ea92d2ea030c
commit 0c727b906ac943583fcfb1eb5cf3ea92d2ea030c
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Mar 8 09:23:44 2013 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Fri Mar 8 09:55:18 2013 -0500
install(EXPORT): Force absolute paths for usr-move
If the absolute install(EXPORT) destination for the CMAKE_INSTALL_PREFIX
used during configuration is under (/usr)?/lib(64)? then assume the
current build is for a system package installation instead of a
relocatable distribution. Generate an absolute path for _IMPORT_PREFIX
in the target exports file instead of generating code to compute the
value relative to the file location. This is necessary for
distributions implementing a move to /usr such as:
https://wiki.archlinux.org/index.php/DeveloperWiki:usrlib
"All files in the /lib directory have been moved to /usr/lib and now
/lib is a symlink to usr/lib."
The relative path computation is not reliable because the targets file
could be installed through cross-prefix a symlink and loaded without it
or vice versa.
A similar change was made for package configuration file generation by
commit d4774140 (configure_package_config_file: force absolute paths for
usr-move, 2013-01-24).
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index b6600f0..8b8b846 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -74,17 +74,35 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
const char* installDest = this->IEGen->GetDestination();
if(!cmSystemTools::FileIsFullPath(installDest))
{
- std::string dest = installDest;
- os << "# Compute the installation prefix relative to this file.\n"
- << "get_filename_component(_IMPORT_PREFIX "
- << "\"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n";
- while(!dest.empty())
+ std::string installPrefix =
+ this->IEGen->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
+ std::string absDest = installPrefix + "/" + installDest + "/";
+ if(strncmp(absDest.c_str(), "/lib/", 5) == 0 ||
+ strncmp(absDest.c_str(), "/lib64/", 7) == 0 ||
+ strncmp(absDest.c_str(), "/usr/lib/", 9) == 0 ||
+ strncmp(absDest.c_str(), "/usr/lib64/", 11) == 0)
{
- os <<
- "get_filename_component(_IMPORT_PREFIX \"${_IMPORT_PREFIX}\" PATH)\n";
- dest = cmSystemTools::GetFilenamePath(dest);
+ // Assume this is a build for system package installation rather than a
+ // relocatable distribution. Use an absolute prefix because some Linux
+ // distros symlink /lib to /usr/lib which confuses the relative path
+ // computation below if we generate for /lib under one prefix and but the
+ // file is loaded from another.
+ os << "set(_IMPORT_PREFIX \"" << installPrefix << "\")\n";
+ }
+ else
+ {
+ std::string dest = installDest;
+ os << "# Compute the installation prefix relative to this file.\n"
+ << "get_filename_component(_IMPORT_PREFIX "
+ << "\"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n";
+ while(!dest.empty())
+ {
+ os <<
+ "get_filename_component(_IMPORT_PREFIX \"${_IMPORT_PREFIX}\" PATH)\n";
+ dest = cmSystemTools::GetFilenamePath(dest);
+ }
+ os << "\n";
}
- os << "\n";
// Import location properties may reference this variable.
this->ImportPrefix = "${_IMPORT_PREFIX}/";
diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h
index ee92906..7aff731 100644
--- a/Source/cmInstallExportGenerator.h
+++ b/Source/cmInstallExportGenerator.h
@@ -36,6 +36,8 @@ public:
cmExportSet* GetExportSet() {return this->ExportSet;}
+ cmMakefile* GetMakefile() const { return this->Makefile; }
+
const std::string& GetNamespace() const { return this->Namespace; }
protected:
-----------------------------------------------------------------------
Summary of changes:
Source/cmExportInstallFileGenerator.cxx | 36 +++++++++++++++++++++++-------
Source/cmInstallExportGenerator.h | 2 +
2 files changed, 29 insertions(+), 9 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list