[CMake] cmake doesn't run all tests

Eric Noulard eric.noulard at gmail.com
Tue May 21 06:11:27 EDT 2019


Le mar. 21 mai 2019 à 11:45, hex <hex7c3 at gmail.com> a écrit :

> hello,
>
> I have two modules in my CMake project:
>
> *root*
> *├── foo*
> *│   ├── CMakeLists.txt*
> *│   ├── src*
> *│   │   └── foo.c*
> *│   └── tests*
> *│       ├── foo_unit_test.c*
> *│       └── CMakeLists.txt*
> *├── CMakeLists.txt*
> *└── moo*
> *    ├── CMakeLists.txt*
> *    ├── src*
> *    │   └── moo.c*
> *    └── tests*
> *        ├── CMakeLists.txt*
> *        └── moo_unit_test.c*
>
> my root project has:
>
> *enable_testing()*
>
> *add_subdirectory(adder)*
> *add_subdirectory(viterbi_encoder)*
>
>
> and each module has:
>
> *add_subdirectory(tests)*
>
>
> For the tests I am using add_test() and make all test.
>
> yet, this only runs the tests within the first add_subdirectory. Other
> modules are ignored.
>
> Do the CMakeLists.txt in the sub-directory have their own project command
or is your main top-level CMakeLists.txt the only CMakeLists.txt with
project  command ?

How can I run all tests at once?
>
> How do yu run the tests?

make tests ?
ninja tests ?
ctest ?

What does
$ ctest -N
says?

This should work at least it "works-for-me" so there must be some
difference between the CMakeLists.txt in the directory that works and in
the directory that does not.
Do you have a sample setup which exhibit the issue that you can share?


Thank you in advance.
>
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake
>


-- 
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190521/cffbfb8b/attachment.html>


More information about the CMake mailing list