From 87f36207a148f29cd2067520c3595d2179ccff8b Mon Sep 17 00:00:00 2001 From: Jarod42 Date: Fri, 22 Mar 2024 08:53:17 +0100 Subject: [PATCH] [vs2010+] Handle `compileas` for files with "unknown" extensions. --- modules/vstudio/tests/vc2010/test_files.lua | 12 ++++++++++++ modules/vstudio/vs2010_vcxproj.lua | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/modules/vstudio/tests/vc2010/test_files.lua b/modules/vstudio/tests/vc2010/test_files.lua index b59888fbd..28e6e532e 100644 --- a/modules/vstudio/tests/vc2010/test_files.lua +++ b/modules/vstudio/tests/vc2010/test_files.lua @@ -657,6 +657,18 @@ ]] end + function suite.onCompileAsExt() + files { "hello.unknown_ext" } + filter "files:hello.unknown_ext" + compileas "C++" + prepare() + test.capture [[ + + + CompileAsCpp + ]] + end + -- -- Check handling of per-file cdialect. -- diff --git a/modules/vstudio/vs2010_vcxproj.lua b/modules/vstudio/vs2010_vcxproj.lua index b31640325..e9ec8525e 100644 --- a/modules/vstudio/vs2010_vcxproj.lua +++ b/modules/vstudio/vs2010_vcxproj.lua @@ -1360,6 +1360,10 @@ if fcfg.buildaction then return m.categories[fcfg.buildaction] or m.categories.None end + + if fcfg.compileas ~= nil and fcfg.compileas ~= "Default" then + return m.categories.ClCompile + end end end