diff options
author | Brad King <brad.king@kitware.com> | 2018-09-28 15:13:52 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-09-28 15:13:59 (GMT) |
commit | 4e98203c6c318f7c2caf4c31b2c2863772eef57b (patch) | |
tree | c41a3178a031cc2fa982c32157766149201bcde2 /Source/cmTarget.cxx | |
parent | 8fea6b0764dbf1b6893e7ca81d93cddca2facfce (diff) | |
parent | 36489b85aa308e3a1b984da0d1e7d3aff4467752 (diff) | |
download | CMake-4e98203c6c318f7c2caf4c31b2c2863772eef57b.zip CMake-4e98203c6c318f7c2caf4c31b2c2863772eef57b.tar.gz CMake-4e98203c6c318f7c2caf4c31b2c2863772eef57b.tar.bz2 |
Merge topic 'vs-global-props-for-all-targets'
36489b85aa VS: Add test for CMAKE_VS_GLOBALS
22e670a306 VS: Add option to set VS_GLOBAL_* for all targets
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2345
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c5295f2..f0d6519 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -454,6 +454,31 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, if (this->TargetTypeValue <= cmStateEnums::UTILITY) { this->SetPropertyDefault("DOTNET_TARGET_FRAMEWORK_VERSION", nullptr); } + + if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY && + this->GetType() != cmStateEnums::UTILITY) { + + // check for "CMAKE_VS_GLOBALS" variable and set up target properties + // if any + const char* globals = mf->GetDefinition("CMAKE_VS_GLOBALS"); + if (globals) { + const std::string genName = mf->GetGlobalGenerator()->GetName(); + if (cmHasLiteralPrefix(genName, "Visual Studio")) { + std::vector<std::string> props; + cmSystemTools::ExpandListArgument(globals, props); + const std::string vsGlobal = "VS_GLOBAL_"; + for (const std::string& i : props) { + // split NAME=VALUE + const std::string::size_type assignment = i.find('='); + if (assignment != std::string::npos) { + const std::string propName = vsGlobal + i.substr(0, assignment); + const std::string propValue = i.substr(assignment + 1); + this->SetPropertyDefault(propName, propValue.c_str()); + } + } + } + } + } } cmGlobalGenerator* cmTarget::GetGlobalGenerator() const |