Skip to content

Commit

Permalink
Fix3355 - use default configuration with no build type
Browse files Browse the repository at this point in the history
When configuring this extension with a CMakePresets.json, with a
CMakeCache.txt that doesn't define a CMAKE_BUILD_TYPE, the intelliSense
configuration was not passed to vscode-cpptools. However, this is a
valid CMake configuration which should use the toolchain's default
configuration. Building through the extension did work.

The codeModelContent configuration was rejected because it's name (""),
didn't match activeBuildTypeVariant which was null.

This patch accepts an unnamed configurations in the case where no active
build type variant is set.
  • Loading branch information
deribaucourt committed Oct 3, 2023
1 parent c146ec4 commit 9b9579d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cpptools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ export class CppConfigurationProvider implements cpptools.CustomConfigurationPro
}
for (const config of opts.codeModelContent.configurations) {
// Update only the active build type variant.
if (config.name === opts.activeBuildTypeVariant) {
if (config.name === opts.activeBuildTypeVariant || (!opts.activeBuildTypeVariant && config.name === "")) {
for (const project of config.projects) {
for (const target of project.targets) {
// Now some shenanigans since header files don't have config data:
Expand Down

0 comments on commit 9b9579d

Please sign in to comment.