On 24.10.2014 20:28, Zé wrote:
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?
"Enable testing for current directory and below."
For the Makefile generator this means that test targets are created for
the build directory that corresponds to the current source directory and
directories below.
If your only enable_testing() call is in <SOURCE_DIR>/unit_tests you
should be able to run "make test" in the corresponding
<BUILD_DIR>/unit_tests directory but not from <BUILD_DIR>.
In theory you can use this to run tests selectively depending on which
directory they are in.
Nils
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake