Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake target RUN_TESTS was not generated

What may be the reason that CMake target RUN_TESTS was not generated in Visual Studio 2015? I can't include the complete CMakeLists.txt as it is huge and consists of many subprojects with own CMakeLists.txt, but it contains enable_testing() command executed, tests are added and built, there is simply no predefined target. Other predefined targets like: ZERO_CHECK, INSTALL, ALL_BUILD are there. My cmake execution is:

cmake -C conaninitialcache.cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_BUILD_TYPE=Debug <source_path>

Could it be the Conan's fault?

like image 960
Piotr G Avatar asked May 25 '20 10:05

Piotr G


Video Answer


1 Answers

It turns out, that when having a project with subprojects, enable_testing() must be located in the root CMakeLists.txt, not in the subprojects, since as the documentation says:

This command should be in the source directory root because ctest expects to find a test file in the build directory root.

https://cmake.org/cmake/help/latest/command/enable_testing.html

like image 189
Piotr G Avatar answered Oct 22 '22 18:10

Piotr G