Open hwhsu1231 opened 2 years ago
Thank you for the feature suggestion. We may not be able to get to it immediately, but we would accept a PR if someone from the community would like to work on this and contribute. I think the settings change as proposed is fine. Acceptable values for cmake.buildDirectory
can be a string or that new object with two properties.
Just putting it out there, what i was looking for and did not find directly online.
This creates build artifacts in the current active folder
"cmake.sourceDirectory": [
"${workspaceFolder}/cpp/src/project1",
"${workspaceFolder}/cpp/src/project2"
],
"cmake.buildDirectory": "${command:cmake.activeFolderPath}/build",
Problem Description
In CMake Generator, there are single- and multi-config generator to choose. If we use single-config, such as
MinGW Makefiles
, I would like to separate build directories for Configurations and Architectures. Thanks to the Substitution Variable provided by CMake-Tools, we can design our custom build directory.1. Single-Config Generator
If I use single-config Generator, for example
MinGW Makefiles
orNMake Makefiles
, one Makefile file only supports one configuration. So in order to differentiate Debug and Release configurations, I will setcmake.buildDirectory
like this:The possible results of build directories will look like this:
2. Multi-Config Generator
However, if I choose to use multi-config generators such as
Ninja Multi-Config
, it is a waste to separate different configurations into individual sub-folders. So I will delete${buildType}
variable from the single-config format. Here is my format ofcmake.buildDirectory
:The possible results of build directories will look like:
Expected Setting
I hope CMake-Tools can give us an option to set
cmake.buildDirectory
for single-config and multi-config, respectively. And Then CMake-Tools will auto-detect which type our currently-used generator belongs to, single-config or multi-config.For example:
Of course, we can still retain the original format of
cmake.buildDirectory
. That means both single- and multi-config will use the same format ofcmake.buildDirectory
:In my case, I would like to set this settings like this:
Platform and Version: