I have a project layout like this:
.
|_ CMakeLists.txt
|_ src
| |_ CMakeLists.txt
| |_ myLib
| |_ tests
| |_ CMakeLists.txt
| |_ add_test(myLibTest my_lib_test)
The problem is that if I enable testing in src/CMakelists.txt
like this:
enable_testing()
add_subdirectory(tests)
CMake compiles my tests, but won't run them:
$ ctest
*********************************
No test configuration file found!
*********************************
Usage
ctest [options]
Why is this?
If I change the layout like this:
.
|_ CMakeLists.txt
|_ src
| |_ CMakeLists.txt
| |_ myLib
|_ tests
| |_ CMakeLists.txt
| |_ add_test(myLibTest my_lib_test)
..and enable testing in ./CMakeLists.txt
then I can run the tests, but of course cannot refer to variables defined in src/CMakeLists.txt
.