Skip to content

Commit 46745af

Browse files
committed
Use sibling capy when building standalone inside boost tree
Before falling back to find_package or FetchContent, check if capy exists as a sibling directory (../capy/). This avoids a redundant clone when building from within the superproject layout.
1 parent fbb82bc commit 46745af

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ option(BOOST_COROSIO_BUILD_PERF "Build boost::corosio performance tools" ${BOOST
2727
option(BOOST_COROSIO_BUILD_EXAMPLES "Build boost::corosio examples" ${BOOST_COROSIO_IS_ROOT})
2828
option(BOOST_COROSIO_MRDOCS_BUILD "Building for MrDocs documentation generation" OFF)
2929

30+
if(NOT TARGET Boost::capy AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../capy/CMakeLists.txt")
31+
set(BOOST_CAPY_BUILD_TESTS OFF CACHE BOOL "" FORCE)
32+
set(BOOST_CAPY_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
33+
add_subdirectory(../capy ${CMAKE_CURRENT_BINARY_DIR}/deps/capy)
34+
endif()
3035
if(NOT TARGET Boost::capy)
3136
find_package(boost_capy QUIET)
3237
endif()

0 commit comments

Comments
 (0)