Request Overview
When running a test from the CTest Explorer, assuming "Cmake: Build Before Run" is enabled, it begins by executing a the command:
Executing command: /path/to/cmake --build /path/to/binaryDir --
This asks CMake to build all in order to run a test. With a successfully, fully-built binary directory is likely to be fast and trivial. However there are some situations this is not desirable. As an example, when working on a cross-cutting change that affects large areas of code, a developer may operate on a single test or area at a time. In the current implementation, everything must build successfully everywhere in order to run a single test.
CMake/CTest already understands what is needed in order to run a particular test.
For example, if the pattern currently sent to CTest with the -R command was sent alongside --show-only=json-v1 the response gives the command as "binarydir/target" such that cmake --build binarydir --target target would check and build what is needed prior to running the test. (If VS Code already has this knowledge internally, then this query won't be necessary and it can simply build the necessary target).
This might also be able to be solved by simply reusing the ${cmake.testProgram} variable. I tried adding it to the "Cmake: Build Args" but it wouldn't expand and was sent literally to CMake. This variable is also not available under Ctest Args and Ctest Default Args.
Happy to consider other solutions as well. The goal is that pressing Run Test, Debug Test, or Run Test with Coverage should be able to perform a build of what is being run, relying on CMake to understand dependencies.
Additional Information
No response
Request Overview
When running a test from the CTest Explorer, assuming "Cmake: Build Before Run" is enabled, it begins by executing a the command:
Executing command: /path/to/cmake --build /path/to/binaryDir --This asks CMake to build all in order to run a test. With a successfully, fully-built binary directory is likely to be fast and trivial. However there are some situations this is not desirable. As an example, when working on a cross-cutting change that affects large areas of code, a developer may operate on a single test or area at a time. In the current implementation, everything must build successfully everywhere in order to run a single test.
CMake/CTest already understands what is needed in order to run a particular test.
For example, if the pattern currently sent to CTest with the -R command was sent alongside
--show-only=json-v1the response gives the command as "binarydir/target" such thatcmake --build binarydir --target targetwould check and build what is needed prior to running the test. (If VS Code already has this knowledge internally, then this query won't be necessary and it can simply build the necessary target).This might also be able to be solved by simply reusing the ${cmake.testProgram} variable. I tried adding it to the "Cmake: Build Args" but it wouldn't expand and was sent literally to CMake. This variable is also not available under Ctest Args and Ctest Default Args.
Happy to consider other solutions as well. The goal is that pressing Run Test, Debug Test, or Run Test with Coverage should be able to perform a build of what is being run, relying on CMake to understand dependencies.
Additional Information
No response