Advertisement
sa2304

Tell CMake to use CTest extension

Nov 6th, 2020
2,544
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 0.53 KB | None | 0 0
  1. # tell CMake to use CTest extension
  2. enable_testing()
  3. add_subdirectory(googletest EXCLUDE_FROM_ALL)
  4.  
  5. # create an executable, which instantiates a runner from
  6. # GoogleTest, Boost.Test, QtTest or whatever framework you use
  7. add_executable(my_test
  8.                test_main.cpp)
  9. target_compile_features(my_test PRIVATE cxx_std_17)
  10.  
  11. # depending on the framework, you need to link to it
  12. target_link_libraries(my_test
  13.                       gtest_main)
  14.  
  15. # now register the executable with CTest
  16. add_test(NAME my_test COMMAND my_test)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement