Detecting when CMake is run from VS Code #4233
multiplemonomials
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I am the maintainer of mbed-ce/mbed-os, and we have functionality in our build system that automatically generates launch.json and tasks.json files (for the Cortex-Debug extension) when CMake runs. This has been working well for us, and it saves a ton of effort writing these files manually.
Where it gets tougher is that we need to detect whether CMake is being run from the command line directly, from VS Code, or from CLion, so that we know what type of run configurations should be generated. CLion provides the
CLION
environment variable which can be used to detect it, but I was not able to find a matching environment variable or CMake variable from this extension. Until now, our workaround was to look for theCMAKE_EXPORT_COMPILE_COMMANDS
option, which is (was?) used by VS Code. However, it seems like this variable is not getting set anymore, at least when using CMake Presets instead of cmake-variants.yml.So I wanted to ask, is there any better way that we can use in CMake to detect VS Code? If not, would it be possible to add one?
Beta Was this translation helpful? Give feedback.
All reactions