From 35c36b3035ec88f0dffafe73c7d22ed7d9159634 Mon Sep 17 00:00:00 2001 From: Manu Zhang Date: Fri, 13 Nov 2026 13:44:50 +0900 Subject: [PATCH] build: vendor FetchContent dependencies by default --- CMakeLists.txt | 6 ++++++ README.md | 7 ++++++- mkdocs/docs/getting-started.md | 7 ++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a9c3b2ff..63ab0036c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,12 @@ option(ICEBERG_ENABLE_ASAN "Enable Address Sanitizer" OFF) option(ICEBERG_ENABLE_UBSAN "Enable Undefined Behavior Sanitizer" OFF) include(GNUInstallDirs) +# Use pinned dependency sources unless the caller explicitly enables package lookup. +set(FETCHCONTENT_TRY_FIND_PACKAGE_MODE + NEVER + CACHE STRING "Whether FetchContent should look for installed dependencies") +set_property(CACHE FETCHCONTENT_TRY_FIND_PACKAGE_MODE PROPERTY STRINGS NEVER OPT_IN + ALWAYS) include(FetchContent) set(ICEBERG_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}") diff --git a/README.md b/README.md index 12755f65f..f8589de66 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,10 @@ ctest --test-dir build --output-on-failure ## Build with CMake +Dependencies managed with CMake FetchContent use the pinned sources by default. +Set `-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=OPT_IN` to try installed packages before +fetching sources. Use a fresh build directory when changing this setting. + ### Build, Run Tests and Install Core Libraries ```bash @@ -85,7 +89,7 @@ cmake --install build #### Provided Apache Arrow ```bash -cmake -S . -B build -G Ninja -DCMAKE_INSTALL_PREFIX=/path/to/install -DCMAKE_PREFIX_PATH=/path/to/arrow -DICEBERG_BUILD_BUNDLE=ON +cmake -S . -B build -G Ninja -DCMAKE_INSTALL_PREFIX=/path/to/install -DCMAKE_PREFIX_PATH=/path/to/arrow -DICEBERG_BUILD_BUNDLE=ON -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=OPT_IN cmake --build build ctest --test-dir build --output-on-failure cmake --install build @@ -95,6 +99,7 @@ cmake --install build | Option | Default | Description | |--------|---------|-------------| +| `FETCHCONTENT_TRY_FIND_PACKAGE_MODE` | `NEVER` | Set to `OPT_IN` to try installed FetchContent dependencies before fetching sources | | `ICEBERG_BUILD_STATIC` | `ON` | Build static library | | `ICEBERG_BUILD_SHARED` | `OFF` | Build shared library | | `ICEBERG_BUILD_TESTS` | `ON` | Build tests | diff --git a/mkdocs/docs/getting-started.md b/mkdocs/docs/getting-started.md index 41d554c42..437c69e15 100644 --- a/mkdocs/docs/getting-started.md +++ b/mkdocs/docs/getting-started.md @@ -39,6 +39,10 @@ ctest --test-dir build --output-on-failure ## Build with CMake +Dependencies managed with CMake FetchContent use the pinned sources by default. +Set `-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=OPT_IN` to try installed packages before +fetching sources. Use a fresh build directory when changing this setting. + ### Core Libraries ```bash @@ -59,7 +63,7 @@ cmake --install build ### Bundle Library (with provided Apache Arrow) ```bash -cmake -S . -B build -G Ninja -DCMAKE_INSTALL_PREFIX=/path/to/install -DCMAKE_PREFIX_PATH=/path/to/arrow -DICEBERG_BUILD_BUNDLE=ON +cmake -S . -B build -G Ninja -DCMAKE_INSTALL_PREFIX=/path/to/install -DCMAKE_PREFIX_PATH=/path/to/arrow -DICEBERG_BUILD_BUNDLE=ON -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=OPT_IN cmake --build build cmake --install build ``` @@ -68,6 +72,7 @@ cmake --install build | Option | Default | Description | |--------|---------|-------------| +| `FETCHCONTENT_TRY_FIND_PACKAGE_MODE` | `NEVER` | Set to `OPT_IN` to try installed FetchContent dependencies before fetching sources | | `ICEBERG_BUILD_STATIC` | `ON` | Build static library | | `ICEBERG_BUILD_SHARED` | `OFF` | Build shared library | | `ICEBERG_BUILD_TESTS` | `ON` | Build tests |