microsoft / microsoft/vscode-cmake-tools

CMake Tools 1.4.0 doesn't define CMAKE_BUILD_TYPE in a project's build directory's CMakeCache.txt

Open
#1,298 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Feature: configure
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### Brief Issue Summary

I am using Visual Studio Code and CMake Tools to build a simple C++ project using OpenCV. The project relies on OpenCV's opencv_world430d.dll and OpenCV_world.dll files. To copy them to the build and install directory, I use an if statement to check whether the CMAKE_BUILD_TYPE matches either Debug or Release; then I define a variable equal to the path to the corresponding debug or release dll. Lastly, I use a custom command to copy the files to the build directory and install them to a desired install location. The problem is, CMAKE_BUILD_TYPE is not defined - even though I've configured the project and selected a Debug configuration.

### Expected:

If build type is Debug, the syntax if(${CMAKE_BUILD_TYPE) MATCHES Debug) should return true; else, if build type is Release, the syntax if(${CMAKE_BUILD_TYPE) MATCHES Release) should return true.

It is expected that CMAKE_BUILD_TYPE is defined as either Debug or Release.

### Apparent Behavior

CMAKE_BUILD_TYPE is not defined.

### Platform and Versions

- **Operating System**: Windows 10
- **CMake Version**: 3.17.3
- **VSCode Version**: 1.45.1
- **CMake Tools Extension Version**: 1.4.0
- **Compiler/Toolchain**: Visual C++ 2019

### Other Notes/Information

Looking in the project's build directory's CMakeCache.txt file, CMAKE_BUILD_TYPE is not included. When I use Visual Studio 2019, the project behaves as expected and CMAKE_BUILD_TYPE is included in the CMakeCache.txt file.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the configured Debug project on Windows 10 with CMake Tools 1.4.0 and inspect the project's build directory's CMakeCache.txt. Compare the extension's behavior with Visual Studio 2019, then trace the configuration path that handles the selected build type; done means the expected build-type value is represented consistently in the cache or the documented behavior is clarified.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, typescript, vscode
Domain
build-system, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.