diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-10-16 17:39:58 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-10-16 18:24:43 (GMT) |
commit | 5794dbc301ace0041c5fc50096cc5331e8ba3c34 (patch) | |
tree | 46b2bdd9cf900a5515286d38a3178e27a740c07b /Source/cmTarget.cxx | |
parent | a892b285f8c621ba50f45f5c4218980c911fd1b6 (diff) | |
download | CMake-5794dbc301ace0041c5fc50096cc5331e8ba3c34.zip CMake-5794dbc301ace0041c5fc50096cc5331e8ba3c34.tar.gz CMake-5794dbc301ace0041c5fc50096cc5331e8ba3c34.tar.bz2 |
cmTarget: Inline the essential part of imported target location.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 68 |
1 files changed, 65 insertions, 3 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 60c5e64..c5e19cc 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2091,13 +2091,75 @@ const char* cmTarget::GetPrefixVariableInternal(bool implib) const //---------------------------------------------------------------------------- std::string -cmTarget::ImportedGetFullPath(const std::string& config, bool implib) const +cmTarget::ImportedGetFullPath(const std::string& config, bool pimplib) const { + assert(this->IsImported()); + + // Lookup/compute/cache the import information for this + // configuration. + std::string config_upper; + if(!config.empty()) + { + config_upper = cmSystemTools::UpperCase(config); + } + else + { + config_upper = "NOCONFIG"; + } + std::string result; - if(cmTarget::ImportInfo const* info = this->GetImportInfo(config)) + + const char* loc = 0; + const char* imp = 0; + std::string suffix; + + if(this->GetType() != cmState::INTERFACE_LIBRARY + && this->GetMappedConfig(config_upper, &loc, &imp, suffix)) { - result = implib? info->ImportLibrary : info->Location; + if (!pimplib) + { + if(loc) + { + result = loc; + } + else + { + std::string impProp = "IMPORTED_LOCATION"; + impProp += suffix; + if(const char* config_location = this->GetProperty(impProp)) + { + result = config_location; + } + else if(const char* location = + this->GetProperty("IMPORTED_LOCATION")) + { + result = location; + } + } + } + else + { + if(imp) + { + result = imp; + } + else if(this->GetType() == cmState::SHARED_LIBRARY || + this->IsExecutableWithExports()) + { + std::string impProp = "IMPORTED_IMPLIB"; + impProp += suffix; + if(const char* config_implib = this->GetProperty(impProp)) + { + result = config_implib; + } + else if(const char* implib = this->GetProperty("IMPORTED_IMPLIB")) + { + result = implib; + } + } + } } + if(result.empty()) { result = this->GetName(); |