summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmComputeLinkInformation.cxx4
-rw-r--r--Source/cmGeneratorTarget.cxx118
-rw-r--r--Source/cmGeneratorTarget.h6
-rw-r--r--Source/cmLocalXCodeGenerator.cxx6
-rw-r--r--Source/cmTarget.cxx112
-rw-r--r--Source/cmTarget.h6
6 files changed, 128 insertions, 124 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index d907dd0..b8e2284 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1783,12 +1783,13 @@ void
cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath,
cmTarget const* target)
{
+ cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(target);
// Ignore targets on Apple where install_name is not @rpath.
// The dependenty library can be found with other means such as
// @loader_path or full paths.
if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{
- if(!target->HasMacOSXRpathInstallNameDir(this->Config))
+ if(!gtgt->HasMacOSXRpathInstallNameDir(this->Config))
{
return;
}
@@ -1810,7 +1811,6 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath,
// Try to get the soname of the library. Only files with this name
// could possibly conflict.
- cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(target);
std::string soName = gtgt->GetSOName(this->Config);
const char* soname = soName.empty()? 0 : soName.c_str();
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 6ad6c69..b253836 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1284,6 +1284,120 @@ bool cmGeneratorTarget::IsChrpathUsed(const std::string& config) const
//----------------------------------------------------------------------------
+bool cmGeneratorTarget::HasMacOSXRpathInstallNameDir(
+ const std::string& config) const
+{
+ bool install_name_is_rpath = false;
+ bool macosx_rpath = false;
+
+ if(!this->IsImported())
+ {
+ if(this->GetType() != cmTarget::SHARED_LIBRARY)
+ {
+ return false;
+ }
+ const char* install_name = this->GetProperty("INSTALL_NAME_DIR");
+ bool use_install_name =
+ this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH");
+ if(install_name && use_install_name &&
+ std::string(install_name) == "@rpath")
+ {
+ install_name_is_rpath = true;
+ }
+ else if(install_name && use_install_name)
+ {
+ return false;
+ }
+ if(!install_name_is_rpath)
+ {
+ macosx_rpath = this->MacOSXRpathInstallNameDirDefault();
+ }
+ }
+ else
+ {
+ // Lookup the imported soname.
+ if(cmTarget::ImportInfo const* info = this->Target->GetImportInfo(config))
+ {
+ if(!info->NoSOName && !info->SOName.empty())
+ {
+ if(info->SOName.find("@rpath/") == 0)
+ {
+ install_name_is_rpath = true;
+ }
+ }
+ else
+ {
+ std::string install_name;
+ cmSystemTools::GuessLibraryInstallName(info->Location, install_name);
+ if(install_name.find("@rpath") != std::string::npos)
+ {
+ install_name_is_rpath = true;
+ }
+ }
+ }
+ }
+
+ if(!install_name_is_rpath && !macosx_rpath)
+ {
+ return false;
+ }
+
+ if(!this->Makefile->IsSet("CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG"))
+ {
+ std::ostringstream w;
+ w << "Attempting to use";
+ if(macosx_rpath)
+ {
+ w << " MACOSX_RPATH";
+ }
+ else
+ {
+ w << " @rpath";
+ }
+ w << " without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being set.";
+ w << " This could be because you are using a Mac OS X version";
+ w << " less than 10.5 or because CMake's platform configuration is";
+ w << " corrupt.";
+ cmake* cm = this->Makefile->GetCMakeInstance();
+ cm->IssueMessage(cmake::FATAL_ERROR, w.str(),
+ this->Target->GetBacktrace());
+ }
+
+ return true;
+}
+
+//----------------------------------------------------------------------------
+bool cmGeneratorTarget::MacOSXRpathInstallNameDirDefault() const
+{
+ // we can't do rpaths when unsupported
+ if(!this->Makefile->IsSet("CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG"))
+ {
+ return false;
+ }
+
+ const char* macosx_rpath_str = this->GetProperty("MACOSX_RPATH");
+ if(macosx_rpath_str)
+ {
+ return this->GetPropertyAsBool("MACOSX_RPATH");
+ }
+
+ cmPolicies::PolicyStatus cmp0042 = this->Target->GetPolicyStatusCMP0042();
+
+ if(cmp0042 == cmPolicies::WARN)
+ {
+ this->Makefile->GetGlobalGenerator()->
+ AddCMP0042WarnTarget(this->GetName());
+ }
+
+ if(cmp0042 == cmPolicies::NEW)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetSOName(const std::string& config) const
{
if(this->Target->IsImported())
@@ -1428,7 +1542,7 @@ cmGeneratorTarget::GetInstallNameDirForBuildTree(
!this->GetPropertyAsBool("SKIP_BUILD_RPATH"))
{
std::string dir;
- if(this->Target->MacOSXRpathInstallNameDirDefault())
+ if(this->MacOSXRpathInstallNameDirDefault())
{
dir = "@rpath";
}
@@ -1464,7 +1578,7 @@ std::string cmGeneratorTarget::GetInstallNameDirForInstallTree() const
}
if(!install_name_dir)
{
- if(this->Target->MacOSXRpathInstallNameDirDefault())
+ if(this->MacOSXRpathInstallNameDirDefault())
{
dir = "@rpath/";
}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index f068cae..fd4ee56 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -409,6 +409,12 @@ public:
bool HaveInstallTreeRPATH() const;
+ /** Whether this library has \@rpath and platform supports it. */
+ bool HasMacOSXRpathInstallNameDir(const std::string& config) const;
+
+ /** Whether this library defaults to \@rpath. */
+ bool MacOSXRpathInstallNameDirDefault() const;
+
private:
friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index b19112d..70997bf 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -56,7 +56,8 @@ void cmLocalXCodeGenerator::Generate()
iter != targets.end(); ++iter)
{
cmTarget* t = &iter->second;
- t->HasMacOSXRpathInstallNameDir("");
+ cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(t);
+ gt->HasMacOSXRpathInstallNameDir("");
}
}
@@ -70,7 +71,8 @@ void cmLocalXCodeGenerator::GenerateInstallRules()
iter != targets.end(); ++iter)
{
cmTarget* t = &iter->second;
- t->HasMacOSXRpathInstallNameDir("");
+ cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(t);
+ gt->HasMacOSXRpathInstallNameDir("");
}
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index dd1d405..0b2d9fc 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2178,118 +2178,6 @@ const char* cmTarget::GetPrefixVariableInternal(bool implib) const
}
//----------------------------------------------------------------------------
-bool cmTarget::HasMacOSXRpathInstallNameDir(const std::string& config) const
-{
- bool install_name_is_rpath = false;
- bool macosx_rpath = false;
-
- if(!this->IsImportedTarget)
- {
- if(this->GetType() != cmTarget::SHARED_LIBRARY)
- {
- return false;
- }
- const char* install_name = this->GetProperty("INSTALL_NAME_DIR");
- bool use_install_name =
- this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH");
- if(install_name && use_install_name &&
- std::string(install_name) == "@rpath")
- {
- install_name_is_rpath = true;
- }
- else if(install_name && use_install_name)
- {
- return false;
- }
- if(!install_name_is_rpath)
- {
- macosx_rpath = this->MacOSXRpathInstallNameDirDefault();
- }
- }
- else
- {
- // Lookup the imported soname.
- if(cmTarget::ImportInfo const* info = this->GetImportInfo(config))
- {
- if(!info->NoSOName && !info->SOName.empty())
- {
- if(info->SOName.find("@rpath/") == 0)
- {
- install_name_is_rpath = true;
- }
- }
- else
- {
- std::string install_name;
- cmSystemTools::GuessLibraryInstallName(info->Location, install_name);
- if(install_name.find("@rpath") != std::string::npos)
- {
- install_name_is_rpath = true;
- }
- }
- }
- }
-
- if(!install_name_is_rpath && !macosx_rpath)
- {
- return false;
- }
-
- if(!this->Makefile->IsSet("CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG"))
- {
- std::ostringstream w;
- w << "Attempting to use";
- if(macosx_rpath)
- {
- w << " MACOSX_RPATH";
- }
- else
- {
- w << " @rpath";
- }
- w << " without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being set.";
- w << " This could be because you are using a Mac OS X version";
- w << " less than 10.5 or because CMake's platform configuration is";
- w << " corrupt.";
- cmake* cm = this->Makefile->GetCMakeInstance();
- cm->IssueMessage(cmake::FATAL_ERROR, w.str(), this->GetBacktrace());
- }
-
- return true;
-}
-
-//----------------------------------------------------------------------------
-bool cmTarget::MacOSXRpathInstallNameDirDefault() const
-{
- // we can't do rpaths when unsupported
- if(!this->Makefile->IsSet("CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG"))
- {
- return false;
- }
-
- const char* macosx_rpath_str = this->GetProperty("MACOSX_RPATH");
- if(macosx_rpath_str)
- {
- return this->GetPropertyAsBool("MACOSX_RPATH");
- }
-
- cmPolicies::PolicyStatus cmp0042 = this->GetPolicyStatusCMP0042();
-
- if(cmp0042 == cmPolicies::WARN)
- {
- this->Makefile->GetGlobalGenerator()->
- AddCMP0042WarnTarget(this->GetName());
- }
-
- if(cmp0042 == cmPolicies::NEW)
- {
- return true;
- }
-
- return false;
-}
-
-//----------------------------------------------------------------------------
bool cmTarget::IsImportedSharedLibWithoutSOName(
const std::string& config) const
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 4b369d3..3cbee76 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -244,12 +244,6 @@ public:
void
GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const;
- /** Whether this library has \@rpath and platform supports it. */
- bool HasMacOSXRpathInstallNameDir(const std::string& config) const;
-
- /** Whether this library defaults to \@rpath. */
- bool MacOSXRpathInstallNameDirDefault() const;
-
/** Test for special case of a third-party shared library that has
no soname at all. */
bool IsImportedSharedLibWithoutSOName(const std::string& config) const;