-
Inside of c_cpp_properties.json, I have application and bootloader configs. This gives me intellesense configurations for each. I have one build kit for ARM GCC. Using CMake and Ninja when not using CMakeTools, but strongly prefer the latter. All I want to do is build for APPLICATION or BOOTLOADER based on a selection inside VS Code somewhere obvious. I can -D define something for CMakeLists.txt to build each config correctly. But I don't know how to get to that point.
I just some direction in what was intended by the developers. EDIT: Is any better to have variants that preface with BOOTLOADER or APPLICATION? Debug: Application Release: Application, etc? That at least seems like a VS Code click and make this happen way. I don't want to change the configure step, I want to get a variable to the build step, so I'm not entirely sure this is right anyhow. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 14 replies
-
I would recommend CMake Presets for this. You basically create two If you use Presets, then you select the one you want to be active (instead of selecting Kits) and the extension will behave the way you expect. If you set it up this way, then you only need one config in
You can still set |
Beta Was this translation helpful? Give feedback.
-
Bob, that is very helpful and I immensely appreciate the fast response. I‘be just skimmed the docs https://github.com/microsoft/vscode-cmake-tools/blob/main/docs/cmake-presets.md That does look like what I want. Although I didn’t see if there was a way to see this from the VS Code UI like the kit and variant. No big deal if not.I’ll enable presets, and update when I get it working.
ps> The example at the bottom of the markdown link is 404
|
Beta Was this translation helpful? Give feedback.
-
I’ll look into that.
Basically I don’t care how it gets done, I just want to get some custom flag inside I can reference inside CMakeList.txt.
I created BUILD_CFG to pass `APPLICATION` or `BOOTLOADER`
The only way I can get it in is in the configure section which creates a selection problem. I saw nativeOption but couldn’t figure out how to get that as a variable to reference inside the lists.txt. Should I still pursue the nativeOption field?
|
Beta Was this translation helpful? Give feedback.
I would recommend CMake Presets for this. You basically create two
configurePresets
that define how you want CMake to generate your cache. Then you createbuildPresets
that will build your differently configured projects (perhaps with additional variations).If you use Presets, then you select the one you want to be active (instead of selecting Kits) and the extension will behave the way you expect. If you set it up this way, then you only need one config in
c_cpp_properties.json
that looks more or less like this:You can still set
compilerPath
,includePath
,defines
, etc as backups in case you're working with a …