microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.47k stars 454 forks source link

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

Open XuPengfei-1020 opened 5 months ago

XuPengfei-1020 commented 5 months ago

Brief Issue Summary

This bug is sill here, and IntelliSense dose completely not work.

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

XuPengfei-1020 commented 5 months ago

It seemd that the history issue about this problem was arbitrary closed but without any fixed. Please tell us the reason of this bug, and how to avoid it.

gcampbell-msft commented 5 months ago

@XuPengfei-1020 I'm sorry, I don't fully understand your issue. Are you saying that you're expecting 'null' in the CMAKE_BUILD_TYPE to work? What issue are you referencing that was closed?

Some more information about the issue you are facing is required in order for us to help out, looking forward to helping you! Thanks.

XuPengfei-1020 commented 5 months ago

@XuPengfei-1020 I'm sorry, I don't fully understand your issue. Are you saying that you're expecting 'null' in the CMAKE_BUILD_TYPE to work? What issue are you referencing that was closed?

Some more information about the issue you are facing is required in order for us to help out, looking forward to helping you! Thanks.

Thanks for your reply.

The error msg is 'Debug' instead of 'DEBUG' OR 'Release' instead of 'RELEASE', dependent on what cmake target I set in the cmake-took config.

I changed the cmake command by replace '-DCMAKE_BUILD_TYPE:STRING=Debug' with '-DCMAKE_BUILD_TYPE:STRING=DEBUG', ran it by hand, the error msg was not appreence any more.

It seems like the DCMAKE_BUILD_TYPE(Debug, Release) in cmake command that cmake-tools assemble is not match the target definition in CMAKELISTS.txt(DEBUG,RELEASE).

v-frankwang commented 5 months ago

@XuPengfei-1020 I tried this issue as you described and got the following results:

Set CMAKE_BUILD_TYPE (Debug) image

Set CMAKE_BUILD_TYPE (DEBUG) image

Is that the question you're trying to get across?

XuPengfei-1020 commented 5 months ago

@v-frankwang Yes, that is. The DCMAKE_BUILD_TYPE in cmake-tools configuration can only be 'Debug' or 'Release', user need to choose a build_type from the preseted DCMAKE_BUILD_TYPE options but can not set a custom DCMAKE_BUILD_TYPE value, It caused the issue that DCMAKE_BUILD_TYPE in build command does not match the build_types which are definated in the CMakeLists.txt.

v-frankwang commented 5 months ago

@gcampbell-msft I reproduced the problem the user described, the exact steps are in my last comment, but I can't pinpoint exactly what's causing it, can you give me some advice?

kuch3n commented 1 month ago

For Multi-Configuration generator CMAKE_BUILD_TYPE isn't used at all and instead CMAKE_CONFIGURATION_TYPES is used. This variable with those generator isn't needed and doesn't change the build configuration at all (configuration, build, package steps).

Instead a build configuration is given with --config. The corresponding preset parameter of a buildPreset is configuration. For a packagePreset multiple build configuration can be given via configurations (see #4096).

Please keep this in mind when fixing this issue

v-frankwang commented 1 month ago

@kuch3n Thank you very much for the heads up, our developers are investigating the issue and we'll update the review as soon as we have any subsequent updates!