1
0
mirror of synced 2024-12-22 20:50:00 +01:00
modern-cmake/chapters/testing.md
Henry Fredrick Schreiner f09ca2ca8b Adding catch and some fixes
2018-03-30 15:15:37 +02:00

639 B

Testing

General Testing Information

In your main CMakeLists.txt you need to add the following function call (not in a subfolder):

enable_testing()

You can register targets with:

add_test(NAME TestName COMMAND TargetName)

If you put something else besides a target name after COMMAND, it will register as a command line to run. It would also be valid to put the generator expression:

add_test(NAME TestName COMMAND $<TARGET_FILE:${TESTNAME}>)

which would use the output location (thus, the executable) of the produced target.

Look at the subchapters for recipes for popular frameworks.