2017-10-21 18:03:43 -04:00
# Testing
## General Testing Information
2018-03-29 19:30:00 +02:00
In your main CMakeLists.txt you need to add the following function call (not in a subfolder):
2017-10-21 18:03:43 -04:00
```cmake
2018-03-29 19:30:00 +02:00
enable_testing()
2017-10-21 18:03:43 -04:00
```
2018-03-30 15:15:37 +02:00
You can register targets with:
```cmake
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:
```cmake
add_test(NAME TestName COMMAND $< TARGET_FILE: $ { TESTNAME } > )
```
which would use the output location (thus, the executable) of the produced target.
2017-10-21 18:03:43 -04:00
2018-03-29 19:30:00 +02:00
Look at the subchapters for recipes for popular frameworks.