Commit 8576b3f9 authored by Clinton Stimpson's avatar Clinton Stimpson Committed by Brad King
Browse files

OS X: Add support for @rpath in export files.

Also expand the IMPORTED_SONAME property for targets
to match the install_name.
parent 00d71bdd
......@@ -211,3 +211,19 @@ cmExportBuildFileGenerator
<< "consider using the APPEND option with multiple separate calls.";
this->ExportCommand->ErrorMessage = e.str();
}
std::string
cmExportBuildFileGenerator::InstallNameDir(cmTarget* target,
const std::string& config)
{
std::string install_name_dir;
cmMakefile* mf = target->GetMakefile();
if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{
install_name_dir =
target->GetInstallNameDirForBuildTree(config.c_str());
}
return install_name_dir;
}
......@@ -61,6 +61,8 @@ protected:
cmTarget* target,
ImportPropertyMap& properties);
std::string InstallNameDir(cmTarget* target, const std::string& config);
std::vector<cmTarget*> const* Exports;
cmExportCommand* ExportCommand;
};
......
......@@ -624,8 +624,12 @@ cmExportFileGenerator
std::string value;
if(target->HasSOName(config))
{
if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{
value = this->InstallNameDir(target, config);
}
prop = "IMPORTED_SONAME";
value = target->GetSOName(config);
value += target->GetSOName(config);
}
else
{
......
......@@ -159,6 +159,9 @@ private:
std::vector<std::string> &missingTargets);
virtual void ReplaceInstallPrefix(std::string &input);
virtual std::string InstallNameDir(cmTarget* target,
const std::string& config) = 0;
};
#endif
......@@ -490,3 +490,19 @@ cmExportInstallFileGenerator
}
cmSystemTools::Error(e.str().c_str());
}
std::string
cmExportInstallFileGenerator::InstallNameDir(cmTarget* target,
const std::string&)
{
std::string install_name_dir;
cmMakefile* mf = target->GetMakefile();
if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{
install_name_dir =
target->GetInstallNameDirForInstallTree();
}
return install_name_dir;
}
......@@ -85,6 +85,8 @@ protected:
void ComplainAboutImportPrefix(cmInstallTargetGenerator* itgen);
std::string InstallNameDir(cmTarget* target, const std::string& config);
cmInstallExportGenerator* IEGen;
std::string ImportPrefix;
......
......@@ -112,3 +112,18 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget* target,
}
}
}
std::string
cmExportTryCompileFileGenerator::InstallNameDir(cmTarget* target,
const std::string& config)
{
std::string install_name_dir;
cmMakefile* mf = target->GetMakefile();
if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{
install_name_dir =
target->GetInstallNameDirForBuildTree(config.c_str());
}
return install_name_dir;
}
......@@ -43,6 +43,8 @@ protected:
ImportPropertyMap& properties,
std::set<cmTarget*> &emitted);
std::string InstallNameDir(cmTarget* target,
const std::string& config);
private:
std::string FindTargets(const char *prop, cmTarget *tgt,
std::set<cmTarget*> &emitted);
......
......@@ -3782,6 +3782,10 @@ std::string cmTarget::GetSOName(const char* config)
else
{
// Use the soname given if any.
if(info->SOName.find("@rpath/") == 0)
{
return info->SOName.substr(6);
}
return info->SOName;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment