cmake - Can't run ctest unless the test executable is named "tests" -


i trying cmake/ctest work. problem ctest not seem pick test executable unless named tests.

in minimal example project have single cmakelists.txt file:

cmake_minimum_required(version 3.0) project(myproject c) enable_testing() set(test_exe_name tests) add_executable(${test_exe_name} test_main.c) add_test(name "my tests" command ${test_exe_name}) 

...and simple test program, test_main.c, passes:

int main() {   return 0; } 

i can run make && make test, , fine long test_exe_name set tests. however, when change executable name else, e.g. mytests, following error:

could not find executable tests looked in following places: tests tests release/tests release/tests debug/tests ... 

what missing?

according cmake manual add_test() test name may not contain spaces:

the test name may not contain spaces, quotes, or other characters special in cmake syntax. 

in problematic example, test named "my tests". changing test name "my_tests" solves problem.

apparently, part of test name after space character (i.e. "tests") interpreted test executable name.


Comments

Popular posts from this blog

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

arrays - Algorithm to find ideal starting spot in a circle -

php - Autoloader issue not returning Class -