Catch lib (unit testing) and CTest (CMake) integration

前端 未结 2 822
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-31 09:47

I\'m looking for successful example of Catch CatchLib integration with CMake test (Ctest) . as I understand this is additional cmake script which has to parse application ouput?

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-31 10:33

    Install catch with:

     $ git clone https://github.com/catchorg/Catch2 
     $ mkdir 
     $ cd 
     $ cmake -DBUILD_TESTING:BOOL=FALSE 
     $ make
     $ make install
    

    Then do add the following to the CMakeLists.txt:

    find_package(Catch2 REQUIRED)
    target_link_libraries(tests Catch2::Catch2)
    

    See here.

提交回复
热议问题