Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force VSCode CMake Tools extension to use "Unix Makefiles" for the generator

By default, CMakeTools picks a generator of his choosing.

In my system, by default, CMake Tools is picking Ninja to be the generator, instead of the desired Unix Makefiles (stored in CMakeCache.txt as CMAKE_GENERATOR:INTERNAL=Ninja)

Supposedly you can force CMakeTools' hand when picking the generator by using the cmake.generator setting in settings.json

When doing by hand cmake -B build in my system, CMakeCache.txt contains CMAKE_GENERATOR:INTERNAL=Unix Makefiles

Thus I set my current settings.json in $workspace/.vscode to

{
    "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
    "cmake.generator": "Unix Makefiles",
}

but when configuring, it still picks Ninja.

What am I doing wrong?

like image 341
WurmD Avatar asked Oct 11 '25 08:10

WurmD


1 Answers

There seems to be a caching issue somewhere. After restarting VSCode it worked as expected

If you alter the "cmake.generator" entry, delete build folder, and rerun CMake's configuration step

[proc] Executing command: /usr/local/bin/cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc-7 -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++-7 -H/home/dario/temp/CMakeToolsTest -B/home/dario/temp/CMakeToolsTest/build -G "Unix Makefiles"

the value after the -G flag does not change accordingly

like image 69
WurmD Avatar answered Oct 15 '25 10:10

WurmD