Skip to content

add_test: dependency to called exe built by add_executable / definition of ARGS in Makefile's test rule

The overall make rule associated to add_test(...) essentially looks like

ctest.exe --force-new-ctest-process $(ARGS).

Is it possible to

  • define ARGS in CMakeLists.txt on a test-by-test basis?
  • to automatically add a dependency (target-exe <- test(exe)) if a test runs an exe built by an add_executable target (with target name, say, target-exe)? I realized that in CMakeTests.txt target-exe is replaced by the full path to the exe.
  • add the feature to optionally add to add_test a cmake target - as opposed to a ctest name - which should be updated if needed before running the test?

Hopefully I did not miss something obvious in the documentation.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information