Skip to content

Commit

Permalink
refactor top level CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
daixtrose committed Jun 27, 2024
1 parent cd31bbe commit cff764f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ cmake_minimum_required(VERSION 3.29)

project(cplusplus-primer)

include(ExternalProject)

foreach(subproject example_1 example_2 example_3 example_4 library_1)
message(STATUS "Creating '${CMAKE_CURRENT_BINARY_DIR}/build_${subproject}'")
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/build_${subproject})
add_custom_target(cplusplus-primer-${subproject} ALL
COMMAND ${CMAKE_COMMAND} -B ${CMAKE_CURRENT_BINARY_DIR}/build_${subproject} -S ${CMAKE_CURRENT_SOURCE_DIR}/${subproject}
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/build_${subproject}
ExternalProject_Add(${subproject}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subproject}
STEP_TARGETS build
INSTALL_COMMAND ""
)
endforeach()

0 comments on commit cff764f

Please sign in to comment.