Skip to content

Commit ed6d9ad

Browse files
authored
Revert "Don't require Ninja or Make on PATH when checking generators (#3927)" (#3938)
This reverts commit bbc74d8.
1 parent 140a429 commit ed6d9ad

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ Bug Fixes:
3030
- Fix localized file path for schema files. [#3872](https://github.com/microsoft/vscode-cmake-tools/issues/3872)
3131
- Disable annoy and invalid extenion message about fix windows sdk for MSVC 2022. [#3837](https://github.com/microsoft/vscode-cmake-tools/pull/3837)
3232
- Fix re-using a terminal for launching even when the environment has changed. [#3478](https://github.com/microsoft/vscode-cmake-tools/issues/3478)
33-
- Don't require Ninja or Make on command line when checking for supported generators. [#3924](https://github.com/microsoft/vscode-cmake-tools/issues/3924)
3433
- Fix our keybindings for debug and run without debugging to better match VS Code. [#3507](https://github.com/microsoft/vscode-cmake-tools/issues/3507)
3534

3635
## 1.18.43

src/drivers/cmakeDriver.ts

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -984,15 +984,25 @@ export abstract class CMakeDriver implements vscode.Disposable {
984984

985985
for (const gen of preferredGenerators) {
986986
const gen_name = gen.name;
987-
if (gen_name === 'Ninja' || gen_name === 'Ninja Multi-Config' ||
988-
gen_name === 'Unix Makefiles') {
989-
return gen;
990-
} else if (gen_name === 'MinGW Makefiles' || gen_name === 'NMake Makefiles' ||
991-
gen_name === 'MSYS Makefiles') {
992-
if (platform === 'win32') {
993-
return gen;
987+
const generator_present = await (async (): Promise<boolean> => {
988+
if (gen_name === 'Ninja' || gen_name === 'Ninja Multi-Config') {
989+
return await this.testHaveCommand('ninja') || this.testHaveCommand('ninja-build');
994990
}
995-
} else {
991+
if (gen_name === 'MinGW Makefiles') {
992+
return platform === 'win32' && this.testHaveCommand('mingw32-make');
993+
}
994+
if (gen_name === 'NMake Makefiles') {
995+
return platform === 'win32' && this.testHaveCommand('nmake', ['/?']);
996+
}
997+
if (gen_name === 'Unix Makefiles') {
998+
return this.testHaveCommand('make');
999+
}
1000+
if (gen_name === 'MSYS Makefiles') {
1001+
return platform === 'win32' && this.testHaveCommand('make');
1002+
}
1003+
return false;
1004+
})();
1005+
if (!generator_present) {
9961006
const vsMatch = /^(Visual Studio \d{2} \d{4})($|\sWin64$|\sARM$)/.exec(gen.name);
9971007
if (platform === 'win32' && vsMatch) {
9981008
return {
@@ -1004,8 +1014,12 @@ export abstract class CMakeDriver implements vscode.Disposable {
10041014
if (gen.name.toLowerCase().startsWith('xcode') && platform === 'darwin') {
10051015
return gen;
10061016
}
1017+
1018+
// If the generator isn't found, move on to the next one
1019+
continue;
1020+
} else {
1021+
return gen;
10071022
}
1008-
// If the generator isn't supported on the current system, move on to the next one.
10091023
}
10101024
return null;
10111025
}

0 commit comments

Comments
 (0)