Reputation: 825
I have a C++ cmake project that uses Boost Test for unit testing. Now I would like to expose a series of bash scripts (used for integration testing) to cmake. Suppose each of this script to return 0 in case of PASS or something != 0 in case of FAILURE. I would like each script to be executed whenever I run cmake test
.
What's the simplest and quickest way to obtain such behavior
Upvotes: 9
Views: 5496
Reputation: 8105
Basically, you want to start by locating the bash program
find_program (BASH_PROGRAM bash)
Then just add your script to the list of tests
if (BASH_PROGRAM)
add_test (mytest ${BASH_PROGRAM} ${CMAKE_CURRENT_SOURCE_DIR}/script.sh)
endif (BASH_PROGRAM)
And all of that should work.
Upvotes: 13