diff options
author | Brad King <brad.king@kitware.com> | 2024-10-02 12:09:15 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2024-10-02 12:09:33 (GMT) |
commit | d8bdc9f3af34173c240e7209f2a0c0303f832e8e (patch) | |
tree | 33dd7086f41c9f46dfb89cf24b7e873350d70b43 /Source | |
parent | ffe07811064c850ff7c75d70965c81e4691bcbdc (diff) | |
parent | 55831faf5ba43650dcab14fbb08b51890cbe954c (diff) | |
download | CMake-d8bdc9f3af34173c240e7209f2a0c0303f832e8e.zip CMake-d8bdc9f3af34173c240e7209f2a0c0303f832e8e.tar.gz CMake-d8bdc9f3af34173c240e7209f2a0c0303f832e8e.tar.bz2 |
Merge topic 'vs-tool-override-fix'
55831faf5b VS: Honor VS_TOOL_OVERRIDE for known source file types too
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9851
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 125 |
1 files changed, 66 insertions, 59 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 1e338b2..694976e 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2544,66 +2544,73 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0) } const char* tool = nullptr; - switch (si.Kind) { - case cmGeneratorTarget::SourceKindAppManifest: - tool = "AppxManifest"; - break; - case cmGeneratorTarget::SourceKindCertificate: - tool = "None"; - break; - case cmGeneratorTarget::SourceKindCustomCommand: - // Handled elsewhere. - break; - case cmGeneratorTarget::SourceKindExternalObject: - tool = "Object"; - break; - case cmGeneratorTarget::SourceKindExtra: - this->WriteExtraSource(e1, si.Source, toolSettings); - break; - case cmGeneratorTarget::SourceKindHeader: - this->WriteHeaderSource(e1, si.Source, toolSettings); - break; - case cmGeneratorTarget::SourceKindIDL: - tool = "Midl"; - break; - case cmGeneratorTarget::SourceKindManifest: - // Handled elsewhere. - break; - case cmGeneratorTarget::SourceKindModuleDefinition: - tool = "None"; - break; - case cmGeneratorTarget::SourceKindCxxModuleSource: - case cmGeneratorTarget::SourceKindUnityBatched: - case cmGeneratorTarget::SourceKindObjectSource: { - const std::string& lang = si.Source->GetLanguage(); - if (lang == "C"_s || lang == "CXX"_s) { - tool = "ClCompile"; - } else if (lang == "ASM_MARMASM"_s && - this->GlobalGenerator->IsMarmasmEnabled()) { - tool = "MARMASM"; - } else if (lang == "ASM_MASM"_s && - this->GlobalGenerator->IsMasmEnabled()) { - tool = "MASM"; - } else if (lang == "ASM_NASM"_s && - this->GlobalGenerator->IsNasmEnabled()) { - tool = "NASM"; - } else if (lang == "RC"_s) { - tool = "ResourceCompile"; - } else if (lang == "CSharp"_s) { - tool = "Compile"; - } else if (lang == "CUDA"_s && - this->GlobalGenerator->IsCudaEnabled()) { - tool = "CudaCompile"; - } else { + const cmValue toolOverride = si.Source->GetProperty("VS_TOOL_OVERRIDE"); + + if (cmNonempty(toolOverride)) { + // Custom tool specified: the file will be built in a user-defined way + this->WriteExtraSource(e1, si.Source, toolSettings); + } else { + switch (si.Kind) { + case cmGeneratorTarget::SourceKindAppManifest: + tool = "AppxManifest"; + break; + case cmGeneratorTarget::SourceKindCertificate: tool = "None"; - } - } break; - case cmGeneratorTarget::SourceKindResx: - this->ResxObjs.push_back(si.Source); - break; - case cmGeneratorTarget::SourceKindXaml: - this->XamlObjs.push_back(si.Source); - break; + break; + case cmGeneratorTarget::SourceKindCustomCommand: + // Handled elsewhere. + break; + case cmGeneratorTarget::SourceKindExternalObject: + tool = "Object"; + break; + case cmGeneratorTarget::SourceKindExtra: + this->WriteExtraSource(e1, si.Source, toolSettings); + break; + case cmGeneratorTarget::SourceKindHeader: + this->WriteHeaderSource(e1, si.Source, toolSettings); + break; + case cmGeneratorTarget::SourceKindIDL: + tool = "Midl"; + break; + case cmGeneratorTarget::SourceKindManifest: + // Handled elsewhere. + break; + case cmGeneratorTarget::SourceKindModuleDefinition: + tool = "None"; + break; + case cmGeneratorTarget::SourceKindCxxModuleSource: + case cmGeneratorTarget::SourceKindUnityBatched: + case cmGeneratorTarget::SourceKindObjectSource: { + const std::string& lang = si.Source->GetLanguage(); + if (lang == "C"_s || lang == "CXX"_s) { + tool = "ClCompile"; + } else if (lang == "ASM_MARMASM"_s && + this->GlobalGenerator->IsMarmasmEnabled()) { + tool = "MARMASM"; + } else if (lang == "ASM_MASM"_s && + this->GlobalGenerator->IsMasmEnabled()) { + tool = "MASM"; + } else if (lang == "ASM_NASM"_s && + this->GlobalGenerator->IsNasmEnabled()) { + tool = "NASM"; + } else if (lang == "RC"_s) { + tool = "ResourceCompile"; + } else if (lang == "CSharp"_s) { + tool = "Compile"; + } else if (lang == "CUDA"_s && + this->GlobalGenerator->IsCudaEnabled()) { + tool = "CudaCompile"; + } else { + tool = "None"; + } + } break; + case cmGeneratorTarget::SourceKindResx: + this->ResxObjs.push_back(si.Source); + break; + case cmGeneratorTarget::SourceKindXaml: + this->XamlObjs.push_back(si.Source); + break; + } } std::string config; |