summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-10-21 12:59:37 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-10-21 12:59:37 (GMT)
commitdd7f9d8393b4dfd470335e662bfb94aaf57f93e1 (patch)
treef5d6ef116e5d2d945e31b9b20d19a2e8edc7fdda /Source/cmTarget.cxx
parente094c8fa0aa3827b0e81660ad5e29d85b216d60f (diff)
parent587ab3221300f04a4de0756dc1a44fa0eac9c0d2 (diff)
downloadCMake-dd7f9d8393b4dfd470335e662bfb94aaf57f93e1.zip
CMake-dd7f9d8393b4dfd470335e662bfb94aaf57f93e1.tar.gz
CMake-dd7f9d8393b4dfd470335e662bfb94aaf57f93e1.tar.bz2
Merge topic 'allow-fallback-config-mapping'
587ab322 Tests: Add test for MAP_IMPORTED_CONFIG_<CONFIG> empty fallback 149d49ea Teach MAP_IMPORTED_CONFIG_<CONFIG> to support configuration-less import 60d73393 Help: Format MAP_IMPORTED_CONFIG_<CONFIG> documentation
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx41
1 files changed, 27 insertions, 14 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 3718d95..6f47f85 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1403,7 +1403,7 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config,
std::string mapProp = "MAP_IMPORTED_CONFIG_";
mapProp += desired_config;
if (const char* mapValue = this->GetProperty(mapProp)) {
- cmSystemTools::ExpandListArgument(mapValue, mappedConfigs);
+ cmSystemTools::ExpandListArgument(mapValue, mappedConfigs, true);
}
}
@@ -1416,20 +1416,33 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config,
for (std::vector<std::string>::const_iterator mci = mappedConfigs.begin();
!*loc && !*imp && mci != mappedConfigs.end(); ++mci) {
// Look for this configuration.
- std::string mcUpper = cmSystemTools::UpperCase(*mci);
- std::string locProp = "IMPORTED_LOCATION_";
- locProp += mcUpper;
- *loc = this->GetProperty(locProp);
- if (allowImp) {
- std::string impProp = "IMPORTED_IMPLIB_";
- impProp += mcUpper;
- *imp = this->GetProperty(impProp);
- }
+ if (mci->empty()) {
+ // An empty string in the mapping has a special meaning:
+ // look up the config-less properties.
+ *loc = this->GetProperty("IMPORTED_LOCATION");
+ if (allowImp) {
+ *imp = this->GetProperty("IMPORTED_IMPLIB");
+ }
+ // If it was found, set the suffix.
+ if (*loc || *imp) {
+ suffix = "";
+ }
+ } else {
+ std::string mcUpper = cmSystemTools::UpperCase(*mci);
+ std::string locProp = "IMPORTED_LOCATION_";
+ locProp += mcUpper;
+ *loc = this->GetProperty(locProp);
+ if (allowImp) {
+ std::string impProp = "IMPORTED_IMPLIB_";
+ impProp += mcUpper;
+ *imp = this->GetProperty(impProp);
+ }
- // If it was found, use it for all properties below.
- if (*loc || *imp) {
- suffix = "_";
- suffix += mcUpper;
+ // If it was found, use it for all properties below.
+ if (*loc || *imp) {
+ suffix = "_";
+ suffix += mcUpper;
+ }
}
}