[CMake] CMake unit tests and the enable_testing() macro
Zé
jose.passes at gmx.com
Fri Oct 24 14:28:10 EDT 2014
I'm test-driving CMake for a new project I've just started and I'm
currently trying to set up a unit test framework. The project is a
dynamic library written in C++, the unit tests are based on Boost test,
and the project tree is organized essentially as follows:
.
├── CMakeLists.txt
├── mylibrary
│ ├── CMakeLists.txt
│ └── sample.c++
└── unit_tests
├── CMakeLists.txt
└── test_sample.c++
I believe that I've managed to get things up and running, but in the
process I've stumbled on an issue.
Apparently, if I call the enable_testing() macro within
${Project}/unit_tests/CMakeLists.txt, calling make test does nothing,
and the following error message is shown:
make: *** No rule to make target `test'. Stop.
Yet, if enable_testing() is called from ${Project}/CMakeLists.txt,
calling make test runs as expected.
Am I missing something?
Thanks
More information about the CMake
mailing list