To use the Catch2 library, we will modify CMakeLists.txt from the previous recipe, to perform the following steps:
- We can keep most of CMakeLists.txt unchanged:
# set minimum cmake versioncmake_minimum_required(VERSION 3.5 FATAL_ERROR)# project name and languageproject(recipe-02 LANGUAGES CXX)# require C++11set(CMAKE_CXX_STANDARD 11)set(CMAKE_CXX_EXTENSIONS OFF)set(CMAKE_CXX_STANDARD_REQUIRED ON)# example libraryadd_library(sum_integers sum_integers.cpp)# main codeadd_executable(sum_up main.cpp)target_link_libraries(sum_up sum_integers)# testing binaryadd_executable(cpp_test test.cpp)target_link_libraries(cpp_test sum_integers)
- The only change, with respect to the previous recipe, is to remove all of the tests except for one, ...