Merge topic 'install-export-usr-move'
0c727b9
install(EXPORT): Force absolute paths for usr-move
This commit is contained in:
commit
556ae30717
|
@ -73,6 +73,23 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
|
||||||
// import file location.
|
// import file location.
|
||||||
const char* installDest = this->IEGen->GetDestination();
|
const char* installDest = this->IEGen->GetDestination();
|
||||||
if(!cmSystemTools::FileIsFullPath(installDest))
|
if(!cmSystemTools::FileIsFullPath(installDest))
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
// 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;
|
std::string dest = installDest;
|
||||||
os << "# Compute the installation prefix relative to this file.\n"
|
os << "# Compute the installation prefix relative to this file.\n"
|
||||||
|
@ -85,6 +102,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
|
||||||
dest = cmSystemTools::GetFilenamePath(dest);
|
dest = cmSystemTools::GetFilenamePath(dest);
|
||||||
}
|
}
|
||||||
os << "\n";
|
os << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
// Import location properties may reference this variable.
|
// Import location properties may reference this variable.
|
||||||
this->ImportPrefix = "${_IMPORT_PREFIX}/";
|
this->ImportPrefix = "${_IMPORT_PREFIX}/";
|
||||||
|
|
|
@ -36,6 +36,8 @@ public:
|
||||||
|
|
||||||
cmExportSet* GetExportSet() {return this->ExportSet;}
|
cmExportSet* GetExportSet() {return this->ExportSet;}
|
||||||
|
|
||||||
|
cmMakefile* GetMakefile() const { return this->Makefile; }
|
||||||
|
|
||||||
const std::string& GetNamespace() const { return this->Namespace; }
|
const std::string& GetNamespace() const { return this->Namespace; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in New Issue