cmake_minimum_required(VERSION 3.20) project( book_exercises VERSION 0.1.0 LANGUAGES CXX) list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") include(ExportCompileCommands) include(sccache) if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) include(CTest) endif() include(FetchContent) configure_file("${PROJECT_SOURCE_DIR}/include/version.h.in" "${PROJECT_BINARY_DIR}/include/version.h") add_subdirectory(chapters) add_executable(book_exercises src/main.cpp) target_compile_features(book_exercises PUBLIC cxx_std_20) target_include_directories( book_exercises PRIVATE "${PROJECT_BINARY_DIR}/include" "${PROJECT_SOURCE_DIR}/include") target_link_libraries(book_exercises PRIVATE chapter_02) set_target_properties( book_exercises PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin" RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin" RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin") if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) add_subdirectory(tests) endif()