summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-09-13 13:29:15 (GMT)
committerBrad King <brad.king@kitware.com>2017-09-13 13:37:30 (GMT)
commitc5b5bb270f54dab4ff529688a26ea8aa271fa0e1 (patch)
tree667a60287a6cdfc51e8578c512fb0b71d187407a
parentffa164736ec78f27583ca4515ff3dfc7a82fc702 (diff)
downloadCMake-c5b5bb270f54dab4ff529688a26ea8aa271fa0e1.zip
CMake-c5b5bb270f54dab4ff529688a26ea8aa271fa0e1.tar.gz
CMake-c5b5bb270f54dab4ff529688a26ea8aa271fa0e1.tar.bz2
VS: Do not consider MAP_IMPORTED_CONFIG_<CONFIG> on non-imported targets
Since commit v3.9.0-rc1~309^2 (include_external_msproject: Honor MAP_IMPORTED_CONFIG_<CONFIG>, 2017-04-04) we accidentally honor `MAP_IMPORTED_CONFIG_<CONFIG>` while generating the `.sln` file entries for normal targets. This causes `devenv.com`-driven builds to use the mapping incorrectly for normal targets. Check that a target really comes from `include_external_msproject` before considering the map. Furthermore, when we do use the map, we should only take the first entry if more than one configuration is specified. Otherwise we end up giving VS a configuration name with a `;` in it. Fixes: #17276
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx14
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx14
2 files changed, 20 insertions, 8 deletions
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index aeceb8d..3b45c90 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -200,10 +200,16 @@ void cmGlobalVisualStudio71Generator::WriteProjectConfigurations(
std::string guid = this->GetGUID(name);
for (std::vector<std::string>::const_iterator i = configs.begin();
i != configs.end(); ++i) {
- const char* dstConfig = target.GetProperty("MAP_IMPORTED_CONFIG_" +
- cmSystemTools::UpperCase(*i));
- if (dstConfig == CM_NULLPTR) {
- dstConfig = i->c_str();
+ std::vector<std::string> mapConfig;
+ const char* dstConfig = i->c_str();
+ if (target.GetProperty("EXTERNAL_MSPROJECT")) {
+ if (const char* m = target.GetProperty("MAP_IMPORTED_CONFIG_" +
+ cmSystemTools::UpperCase(*i))) {
+ cmSystemTools::ExpandListArgument(m, mapConfig);
+ if (!mapConfig.empty()) {
+ dstConfig = mapConfig[0].c_str();
+ }
+ }
}
fout << "\t\t{" << guid << "}." << *i << ".ActiveCfg = " << dstConfig
<< "|" << platformName << std::endl;
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 7a42b72..f06a8a1 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -354,10 +354,16 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations(
std::string guid = this->GetGUID(name);
for (std::vector<std::string>::const_iterator i = configs.begin();
i != configs.end(); ++i) {
- const char* dstConfig = target.GetProperty("MAP_IMPORTED_CONFIG_" +
- cmSystemTools::UpperCase(*i));
- if (dstConfig == CM_NULLPTR) {
- dstConfig = i->c_str();
+ std::vector<std::string> mapConfig;
+ const char* dstConfig = i->c_str();
+ if (target.GetProperty("EXTERNAL_MSPROJECT")) {
+ if (const char* m = target.GetProperty("MAP_IMPORTED_CONFIG_" +
+ cmSystemTools::UpperCase(*i))) {
+ cmSystemTools::ExpandListArgument(m, mapConfig);
+ if (!mapConfig.empty()) {
+ dstConfig = mapConfig[0].c_str();
+ }
+ }
}
fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName()
<< ".ActiveCfg = " << dstConfig << "|"