2023-10-10 12:42:07 +00:00
|
|
|
cmake_minimum_required(VERSION 3.20)
|
|
|
|
|
|
|
|
project(
|
2023-10-21 09:43:01 +00:00
|
|
|
book_exercises
|
2023-10-11 18:49:32 +00:00
|
|
|
VERSION 0.1.0
|
2023-10-10 12:42:07 +00:00
|
|
|
LANGUAGES CXX)
|
|
|
|
|
2023-10-12 09:54:14 +00:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
2023-10-10 12:42:07 +00:00
|
|
|
|
2023-10-12 09:54:14 +00:00
|
|
|
include(ExportCompileCommands)
|
2023-10-20 08:58:31 +00:00
|
|
|
include(sccache)
|
2023-10-10 12:42:07 +00:00
|
|
|
|
2023-10-20 08:59:30 +00:00
|
|
|
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
|
|
|
include(CTest)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
include(FetchContent)
|
|
|
|
|
2023-10-11 18:49:32 +00:00
|
|
|
configure_file("${PROJECT_SOURCE_DIR}/include/version.h.in"
|
|
|
|
"${PROJECT_BINARY_DIR}/include/version.h")
|
|
|
|
|
2023-10-21 09:43:01 +00:00
|
|
|
add_subdirectory(chapters)
|
2023-10-18 18:29:41 +00:00
|
|
|
|
2023-10-21 09:43:01 +00:00
|
|
|
add_executable(book_exercises src/main.cpp)
|
2023-10-11 18:49:32 +00:00
|
|
|
|
2023-10-21 09:43:01 +00:00
|
|
|
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)
|
2023-10-20 08:59:30 +00:00
|
|
|
|
2023-10-22 10:58:19 +00:00
|
|
|
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")
|
|
|
|
|
2023-10-20 08:59:30 +00:00
|
|
|
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
|
|
|
add_subdirectory(tests)
|
|
|
|
endif()
|