Skip to content

Commit b440fc6

Browse files
Using vswhere for msvc
1 parent a3f005b commit b440fc6

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

DefaultYAMLs/DefaultUserConfig.yaml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# List of anchors that will be aliased later
22
Templates:
33
MSVC_CompileFlags: &MSVC_CompileFlags
4-
Flags: "/NOLOGO /W4 /diagnostics:caret /D NDEBUG /utf-8 /Gm- /MD /EHa /TP /std:c++17 /GR /TP"
4+
Flags: "/nologo /W4 /diagnostics:caret /D NDEBUG /utf-8 /Gm- /MD /EHa /TP /std:c++17 /GR /TP"
55

66
"g++_CompileRunParts": &g++_CompileRunParts
77
- Type: Once
@@ -135,8 +135,7 @@ Profiles:
135135

136136
# Specify the compiler settings
137137
Compiler:
138-
# (Optional) The command to run together before running each compile command
139-
# in **shell** for each platform
138+
# (Optional) The command to be prepend for each compile command in **shell** for each platform
140139
# PreRun:
141140
# Default: ""
142141

@@ -190,8 +189,7 @@ Profiles:
190189

191190
# Specify the linker settings
192191
Linker:
193-
# (Optional) The command to run together before running each link command
194-
# in **shell** for each platform
192+
# (Optional) The command to be prepend for each link command in **shell** for each platform
195193
# PreRun:
196194
# Default: ""
197195

@@ -268,9 +266,18 @@ Profiles:
268266
Languages: ["c++"]
269267
FileExtensions: [.cpp, .cc, .cxx]
270268
FilesTypes: *CommonFilesTypes
269+
Setup:
270+
Windows:
271+
- >-
272+
for /f "usebackq tokens=*" %i in (`CALL "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
273+
-version "[17.0,18.0)" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
274+
echo "%i\VC\Auxiliary\Build\vcvarsall.bat" x64 > .\prerun.bat
275+
)
276+
Cleanup:
277+
Windows: [ "del .\\prerun.bat" ]
271278
Compiler:
272279
PreRun:
273-
Windows: "\"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat\" x64"
280+
Windows: ".\\prerun.bat"
274281
CheckExistence:
275282
Windows: "where.exe CL.exe"
276283
CompileTypes:
@@ -292,7 +299,7 @@ Profiles:
292299
# Specify the linker settings
293300
Linker:
294301
PreRun:
295-
Windows: "\"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat\" x64"
302+
Windows: ".\\prerun.bat"
296303
CheckExistence:
297304
Windows: "where.exe link.exe"
298305
LinkTypes:

0 commit comments

Comments
 (0)