project(addressbook LANGUAGES CXX VERSION 0.0.1) # https://cmake.org/cmake/help/latest/module/FindProtobuf.html find_package(Protobuf REQUIRED) include_directories(${Protobuf_INCLUDE_DIRS}) include_directories(${CMAKE_CURRENT_BINARY_DIR}) protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS addressbook.proto) add_library(${PROJECT_NAME} ${PROTO_SRCS} #${PROTO_HDRS} ) target_link_libraries(${PROJECT_NAME} PRIVATE # private implementation, others can not link with this library protobuf::libprotobuf ) target_include_directories(${PROJECT_NAME} PUBLIC # Will make these headers availvable to the library itself # and to any target trying to link agains it ${CMAKE_CURRENT_BINARY_DIR} ) #if(testing_enabled) # https://cmake.org/cmake/help/book/mastering-cmake/chapter/Testing%20With%20CMake%20and%20CTest.html add_executable(${PROJECT_NAME}-test test.cpp ) target_link_libraries(${PROJECT_NAME}-test PRIVATE Catch2::Catch2WithMain) catch_discover_tests(${PROJECT_NAME}-test) add_test( NAME "Custom-test-script" #CONFIGURATIONS "systemt" #COMMAND $:ctest --success COMMAND echo "testing [OK]" ) #endif()