diff options
author | Alexander Boczar <alexboc@microsoft.com> | 2019-09-16 21:14:20 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-10-15 17:28:45 (GMT) |
commit | 548e9051a4f20657d04341107924171ea9d1bcb5 (patch) | |
tree | 4b7aba7800a6a193396aabf4ab4259029db9ec35 /Source/cmGlobalVisualStudio10Generator.cxx | |
parent | 99e83d423500e11a8e85c2032e8c536bce175ed1 (diff) | |
download | CMake-548e9051a4f20657d04341107924171ea9d1bcb5.zip CMake-548e9051a4f20657d04341107924171ea9d1bcb5.tar.gz CMake-548e9051a4f20657d04341107924171ea9d1bcb5.tar.bz2 |
VS: Add support to override VCTargetsPath through toolset
Fixes: #19708
Diffstat (limited to 'Source/cmGlobalVisualStudio10Generator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.cxx | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 63915c5..5b83e2f 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -26,6 +26,16 @@ static const char vs10generatorName[] = "Visual Studio 10 2010"; static std::map<std::string, std::vector<cmIDEFlagTable>> loadedFlagJsonFiles; +static void ConvertToWindowsSlashes(std::string& s) +{ + // first convert all of the slashes + for (auto& ch : s) { + if (ch == '/') { + ch = '\\'; + } + } +} + // Map generator name without year to name with year. static const char* cmVS10GenName(const std::string& name, std::string& genName) { @@ -212,7 +222,7 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( return true; } - if (!this->FindVCTargetsPath(mf)) { + if (this->CustomVCTargetsPath.empty() && !this->FindVCTargetsPath(mf)) { return false; } @@ -353,6 +363,11 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( if (const char* cudaDir = this->GetPlatformToolsetCudaCustomDir()) { mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR", cudaDir); } + if (const char* vcTargetsDir = this->GetCustomVCTargetsPath()) { + mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR", + vcTargetsDir); + } + return true; } @@ -446,6 +461,11 @@ bool cmGlobalVisualStudio10Generator::ProcessGeneratorToolsetField( this->GeneratorToolsetVersion = value; return true; } + if (key == "VCTargetsPath") { + this->CustomVCTargetsPath = value; + ConvertToWindowsSlashes(this->CustomVCTargetsPath); + return true; + } return false; } @@ -607,6 +627,14 @@ void cmGlobalVisualStudio10Generator::EnableLanguage( cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional); } +const char* cmGlobalVisualStudio10Generator::GetCustomVCTargetsPath() const +{ + if (this->CustomVCTargetsPath.empty()) { + return nullptr; + } + return this->CustomVCTargetsPath.c_str(); +} + const char* cmGlobalVisualStudio10Generator::GetPlatformToolset() const { std::string const& toolset = this->GetPlatformToolsetString(); |