[CMake] Target `test' empty

Quaquaraquà nuquaquaraqua at gmail.com
Sat Jun 23 10:47:09 EDT 2018


Dear users,

I'm new to the build system. I am trying to create the target `test' to 
run all test suites. I'm using GoogleTest to make a test suite:

in test/CMakeLists.txt

file(GLOB test_files LIST_DIRECTORIES false *.cpp)
add_executable(test_driver ${test_files})
target_link_libraries(test_driver gtest_main)
add_test(NAME test_driver COMMAND test_driver)

in /CMakeLists.txt
add_subdirectory(test)

this effectively creates the test suite so that can be invoked through 
test/test_driver. However I thought that the suite, at least if I set 
the param EXCLUDE_FROM_ALL in add_executable, would be built and 
executed as part of `make test', similarly to `make check' in AutoTools 
builds.

What is the correct way to integrate the test suite with CTest?

Thanks,

Quaquaraqua

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180623/800a75c7/attachment.html>


More information about the CMake mailing list