diff options
author | Mikhail Korolev <stilriv@gmail.com> | 2018-09-21 11:23:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-09-25 13:20:25 (GMT) |
commit | 22e670a3062869e3014455563d800c72f35d9e4f (patch) | |
tree | 6f228ae2dad2b3625d353961ffb6c89456a38372 /Source/cmTarget.cxx | |
parent | 227b2be9d6a77efd95c4e99aab8e6255cb95a380 (diff) | |
download | CMake-22e670a3062869e3014455563d800c72f35d9e4f.zip CMake-22e670a3062869e3014455563d800c72f35d9e4f.tar.gz CMake-22e670a3062869e3014455563d800c72f35d9e4f.tar.bz2 |
VS: Add option to set VS_GLOBAL_* for all targets
Fixes: #18287
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 4e353c7..a338fe3 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -440,6 +440,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 |