Active build configuration warning

See original GitHub issue

With current CMT code base, any project gets a warning from CppTools about. This is with presets on, but even if the currently selected configure preset does define CMAKE_BUILD_TYPE.

The build configurations generated do not contain the active build configuration. Using 'Debug' for CMAKE_BUILD_TYPE instead of 'null' to ensure that IntelliSense configurations can be found.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:6
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ntzzccommented, Sep 1, 2022

I meet same issue on ubuntu/gcc, in my case, the problem is caused by 2 line in CMakeLists.txt which defined different BUILD_TYPE again.

set(CMAKE_BUILD_TYPE Release)

set(CMAKE_CXX_FLAGS “-std=c++14 -O3 -DMINIGLOG=ON”),

vscode worked as expected after comment those two lines

1reaction
chausnercommented, May 14, 2022

I am running into the same or a very similar error. Using Ubuntu with gcc, the CMake project uses a toolchain generated by Conan. I also am using CMake presets.

I install two configurations (Debug and Release) with Conan, the CMakePresets.json generated by Conan has two configurations:

    "configurePresets": [
        {
            "name": "Debug",
            "displayName": "Debug Config",
            "description": "Debug configure using 'Unix Makefiles' generator",
            "generator": "Unix Makefiles",
            "cacheVariables": {
                "CMAKE_POLICY_DEFAULT_CMP0091": "NEW",
                "CMAKE_BUILD_TYPE": "Debug"
            },
            "toolchainFile": "/home/chris/conantest/build/generators/conan_toolchain.cmake",
            "binaryDir": "/home/chris/conantest/cmake-build-debug"
        },
        {
            "name": "Release",
            "displayName": "Release Config",
            "description": "Release configure using 'Unix Makefiles' generator",
            "generator": "Unix Makefiles",
            "cacheVariables": {
                "CMAKE_POLICY_DEFAULT_CMP0091": "NEW",
                "CMAKE_BUILD_TYPE": "Release"
            },
            "toolchainFile": "/home/chris/conantest/build/generators/conan_toolchain.cmake",
            "binaryDir": "/home/chris/conantest/cmake-build-release"
        }
    ],
    "buildPresets": [
        {
            "name": "Debug",
            "configurePreset": "Debug"
        },
        {
            "name": "Release",
            "configurePreset": "Release"
        }
    ],

I’ve noticed that the cpptools warning always occurs when switching to a configuration that has not been built last. E.g. I configure “Debug”, build “Debug”, switch to “Release”, then it would show

[cpptools] The build configurations generated do not contain the active build configuration. Using “Debug” for CMAKE_BUILD_TYPE instead of “Release” to ensure that IntelliSense configurations can be found

If I then build in Release mode and switch the config back to “Debug”, it shows

[cpptools] The build configurations generated do not contain the active build configuration. Using “Release” for CMAKE_BUILD_TYPE instead of “Debug” to ensure that IntelliSense configurations can be found

Output of CMake: Log Diagnostics:

{
  "os": "linux",
  "vscodeVersion": "1.67.1",
  "cmtVersion": "1.10.0",
  "configurations": [
    {
      "folder": "/home/chris/conantest",
      "cmakeVersion": "3.23.1",
      "configured": true,
      "generator": "Unix Makefiles",
      "usesPresets": true,
      "compilers": {
        "CXX": "/usr/bin/c++"
      }
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": true,
    "activeBuildType": "Debug",
    "buildTypesSeen": [
      "Release"
    ],
    "requests": [
      "file:///home/chris/conantest/soxrtest.cpp"
    ],
    "responses": [
      {
        "uri": "file:///home/chris/conantest/soxrtest.cpp",
        "configuration": {
          "defines": [
            "_GLIBCXX_USE_CXX11_ABI=0",
            "NDEBUG"
          ],
          "includePath": [
            "/home/chris/.conan/data/soxr/0.1.3/_/_/package/fcf0f374adec7fe3c03d5a485bea5cbf91c66ab4/include"
          ],
          "compilerPath": "/usr/bin/c++",
          "compilerArgs": [
            "-m64",
            "-O3",
            "-DNDEBUG"
          ]
        }
      }
    ],
    "partialMatches": [],
    "targetCount": 1,
    "executablesCount": 1,
    "librariesCount": 0,
    "targets": [
      {
        "name": "soxrtest",
        "type": "EXECUTABLE"
      }
    ]
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": true
    }
  ]
}

I think the problem lies in

    "activeBuildType": "Debug",
    "buildTypesSeen": [
      "Release"
    ],

The cpptools extension only seems to see the last-built build type but the active build type can be different.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the meaning of "Active build Configuration" - TI E2E
Briefly - a build configuration defines a set a build options at the project level. It is useful if you need to switch...
Read more >
Understand build configurations - Visual Studio (Windows)
Learn how you need build configurations when you need to build your projects with different settings in Visual Studio.
Read more >
CMAKE_BUILD_TYPE is not being used in CMakeLists.txt
This will print to the standard error every access to this variable. And to get it to log file, do something like: cmake...
Read more >
Solved: Always get "Errors exist in the active configurati...
Always get "Errors exist in the active configuration" message when I debug ... Deleting the current build folder (i.e., "Debug") resolved the issue...
Read more >
From Cake to Nuke - Files in use and Visual Studio Active ...
Now that this change has been made, if you try to run a nuke build, it will raise a warning that there is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found