refactor: restructure project to build a library for each book chapter
parent
5a3798a604
commit
dfaee89d56
|
@ -1,7 +1,7 @@
|
|||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
project(
|
||||
hello
|
||||
book_exercises
|
||||
VERSION 0.1.0
|
||||
LANGUAGES CXX)
|
||||
|
||||
|
@ -19,13 +19,17 @@ include(FetchContent)
|
|||
configure_file("${PROJECT_SOURCE_DIR}/include/version.h.in"
|
||||
"${PROJECT_BINARY_DIR}/include/version.h")
|
||||
|
||||
add_executable(hello src/main.cpp src/null.cpp src/constexp.cpp
|
||||
src/ifswitch.cpp src/initlist.cpp)
|
||||
add_subdirectory(chapters)
|
||||
|
||||
target_compile_features(hello PUBLIC cxx_std_20)
|
||||
add_executable(book_exercises src/main.cpp)
|
||||
|
||||
target_include_directories(hello PRIVATE "${PROJECT_BINARY_DIR}/include"
|
||||
"${PROJECT_SOURCE_DIR}/include")
|
||||
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)
|
||||
|
||||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
||||
add_subdirectory(tests)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
add_subdirectory(chapter_02)
|
|
@ -0,0 +1,4 @@
|
|||
add_library(chapter_02 src/initlist.cpp src/null.cpp src/constexp.cpp
|
||||
src/ifswitch.cpp)
|
||||
|
||||
target_include_directories(chapter_02 PUBLIC include)
|
Loading…
Reference in New Issue