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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With