question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CMAKE_BUILD_TYPE value empty on configure and install using VS Code

See original GitHub issue

I am using VS Code on windows 10 since last year, and it is working perfectly with vscode-cmake-tools. Cmake command:

message("Build type of project is : " ${CMAKE_BUILD_TYPE})

The expectation is when I configure cmake project it should show the selected configuration. When Debug build is selected from status bar of VS code. Expected result would be:

Build type of project is : Debug

But unfortunately, it is not showing build type

Build type of project is : 

Same case happened when I Cmake: Release project. It is not able to detect the selected build type. Can anyone please suggest what to do in this case to get selected values in cmake_build_type ?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bobbrowcommented, Jul 20, 2020

I see a mispelling in your preferredGenerators setting from your response. Can you confirm which generator is actually being selected? CMAKE_BUILD_TYPE is not set when Visual Studio is the generator because it generates a project with all build types. Ninja will set the CMAKE_BUILD_TYPE because it only generates one build type per variant.

0reactions
bobbrowcommented, Jul 20, 2020

Glad to hear it’s working now!

Read more comments on GitHub >

github_iconTop Results From Across the Web

CMAKE_BUILD_TYPE is not being used in CMakeLists.txt
Meaning that that value will be updated permanently from that point to the end of the configuration run. One great way to track...
Read more >
CMAKE_BUILD_TYPE — CMake 3.25.1 Documentation
The default value is often an empty string, but this is usually not desirable and one of the other standard build types is...
Read more >
CMAKE_BUILD_TYPE variable not set - Visual Studio Feedback
I noticed this problem because I need CMAKE_BUILD_TYPE variable in my CmakeLists.txt and I found out that it is actually empty in Visual...
Read more >
vscode-cmake-tools/support - Gitter
"Unable to determine what CMake generator to use. Please install or configure a preferred generator, or update settings.json or your Kit configuration." I...
Read more >
CMake and the Default Build Type - Kitware Inc.
It will now default to using a debug build if the source directory is a git clone, or a release build if not....
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