简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM