diff options
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 4e3a345..3da4627 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2048,7 +2048,17 @@ std::string cmTarget::GetSOName(const char* config) // Lookup the imported soname. if(cmTarget::ImportInfo const* info = this->GetImportInfo(config)) { - return info->SOName; + if(info->NoSOName) + { + // The imported library has no builtin soname so the name + // searched at runtime will be just the filename. + return cmSystemTools::GetFilenameName(info->Location); + } + else + { + // Use the soname given if any. + return info->SOName; + } } else { @@ -2069,6 +2079,19 @@ std::string cmTarget::GetSOName(const char* config) } //---------------------------------------------------------------------------- +bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config) +{ + if(this->IsImported() && this->GetType() == cmTarget::SHARED_LIBRARY) + { + if(cmTarget::ImportInfo const* info = this->GetImportInfo(config)) + { + return info->NoSOName; + } + } + return false; +} + +//---------------------------------------------------------------------------- std::string cmTarget::NormalGetRealName(const char* config) { // This should not be called for imported targets. @@ -3054,6 +3077,9 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, // properties. The "IMPORTED_" namespace is reserved for properties // defined by the project exporting the target. + // Initialize members. + info.NoSOName = false; + // Track the configuration-specific property suffix. std::string suffix = "_"; suffix += desired_config; @@ -3164,6 +3190,21 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, } } + // Get the "no-soname" mark. + if(this->GetType() == cmTarget::SHARED_LIBRARY) + { + std::string soProp = "IMPORTED_NO_SONAME"; + soProp += suffix; + if(const char* config_no_soname = this->GetProperty(soProp.c_str())) + { + info.NoSOName = cmSystemTools::IsOn(config_no_soname); + } + else if(const char* no_soname = this->GetProperty("IMPORTED_NO_SONAME")) + { + info.NoSOName = cmSystemTools::IsOn(no_soname); + } + } + // Get the import library. if(this->GetType() == cmTarget::SHARED_LIBRARY || this->IsExecutableWithExports()) |