Hi,
I would like to use the built-in facilities of VSCode to invoke ctest
. However, I am unable to tell it to step into a given --test-dir
via CMakePresets.json
.
And so I get one of two symptoms:
- if I call
enable_testing()
in the top-levelCMakeLists.txt
it attempts to run tests, including some which I don’t want it to run (defined by dependencies included withadd_subdirectory()
); but more importantly which cannot run - if I call
enable_testing()
where the test is defined (a subsubdirectory calledunit-test
) that works when invoked manually as in this case I can pass--test-dir
, but not viaCMakePresets.json
which seems to go by the assumption that the tests are to be invoked in the directory of the top-levelCMakeLists.txt
… additionally because the respective file gets generated at the wrong directory level, I get a complaint aboutDartConfiguration.tcl
missing, which doesn’t seem to be fatal, though
How can I teach VSCode through CMakePresets.json
where to point ctest
upon invocation, without hardcoding the --test-dir
option plus its argument in the global VSCode settings?
Thanks in advance for any insights.
PS: the Linux distro is Mint, based upon Ubuntu 24.04 LTS, in case it matters. CMake is the latest from the APT repo of Kitware (3.31).