Skip to content

Conversation

gibber9809
Copy link
Contributor

@gibber9809 gibber9809 commented Jun 2, 2025

Description

This PR adds flags that external projects can use to disable almost every part of the clp core build. This allows external projects to depend on some parts of clp without needing to install dependencies used by components the external project does not need.

We also bump the required cmake version to 3.21 to ensure all the cmake features we use are supported (in particular the SOURCE_SUBDIR argument for FetchContent_Declare/ExternalProject_Add in 3.18 and PROJECT_IS_TOP_LEVEL in 3.21).

These flags are all prefixed with CLP_BUILD_ and the corresponding targets are wrapped in if(CLP_BUILD_...). All of these CLP_BUILD_ flags are cache options defaulting to true, so by default are targets are built.

These flags are used to derive a set of CLP_NEED_X flags that indicate which library dependencies are required to satisfy all of the targets being built. Each find_package call is wrapped by the CLP_NEED_X flag for the corresponding library.

We write one validate_x_dependencies and set_x_dependencies function for each CLP_BUILD_ flag. The validate function for each target ensures that the CLP_BUILD_X flags for all of its dependencies are true, and emits a FATAL_ERROR message otherwise. The set dependencies function for a target sets all of the CLP_NEED_ flags directly linked against by the target.

Together these functions ensure that

  1. The user has specified a legal combination of CLP_BUILD_X options
  2. find_package is called for only the set of libraries actually needed by the build
  3. add_library and add_executable are called only for the targets where CLP_BUILD_X is true

For convenience we wrap all of the validate/set functions in a function called validate_and_setup_all_clp_dependency_flags. To allow flags set inside of these functions to be exposed as variables to the caller users need to follow a call to that function with convert_clp_dependency_properties_to_variables.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

  • Validated that a project with the following cmake script could add clp as an external project and build only the necessary components to link against clp_s::search
cmake_minimum_required(VERSION 3.21)

project(TEST_PROJ LANGUAGES CXX C)

# Modules copied from clp for simplicity
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

# Dependencies taken from clp for simplicity
include("${CMAKE_SOURCE_DIR}/../clp/build/deps/core/cmake-settings/all.cmake"
        OPTIONAL
        RESULT_VARIABLE CLP_DEPS_SETTINGS_FILE_PATH
)

include(FetchContent)

FetchContent_Declare(
        clp
        SOURCE_DIR "${CMAKE_SOURCE_DIR}/../clp/"
        SOURCE_SUBDIR "components/core/"
)

set(CLP_USE_STATIC_LIBS ON CACHE BOOL "")
set(CLP_BUILD_EXECUTABLES OFF CACHE BOOL "")
set(CLP_BUILD_TESTING OFF CACHE BOOL "")
set(CLP_BUILD_CLP_REGEX_UTILS OFF CACHE BOOL "")
set(CLP_BUILD_CLP_S_ARCHIVEWRITER OFF CACHE BOOL "")
set(CLP_BUILD_CLP_S_JSONCONSTRUCTOR OFF CACHE BOOL "")
set(CLP_BUILD_CLP_S_REDUCER_DEPENDENCIES OFF CACHE BOOL "")
set(CLP_BUILD_CLP_S_SEARCH_SQL OFF CACHE BOOL "")

FetchContent_MakeAvailable(clp)

add_executable(test test.cpp)
target_compile_features(test PRIVATE cxx_std_20)
target_link_libraries(test clp_s::search)

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced build-time options to selectively enable or disable building specific binaries, libraries, and tests using configuration flags.
    • Users can now exclude certain executables or components from the build process, providing greater flexibility and control over what is built.
  • Chores

    • Updated minimum required CMake version.
    • Improved build configuration logic for external dependencies and test targets.

@gibber9809 gibber9809 requested review from a team and wraymo as code owners June 2, 2025 16:31
Copy link
Contributor

coderabbitai bot commented Jun 2, 2025

## Walkthrough

This change introduces conditional CMake logic throughout the build system, allowing selective enabling or disabling of binaries, libraries, tests, and dependencies using dedicated `CLP_BUILD_*` flags. All affected targets and dependency checks are now wrapped in conditionals, providing fine-grained control over the build process without altering code interfaces.

## Changes

| Files/Paths                                                                                      | Change Summary                                                                                                             |
|-------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
| components/core/CMakeLists.txt                                                                   | Increased CMake minimum version; included new options file; wrapped all dependency checks and test target creation in `if(CLP_NEED_*)` and `if(CLP_BUILD_TESTING)` conditionals. |
| components/core/src/clp/clg/CMakeLists.txt<br>components/core/src/clp/clo/CMakeLists.txt<br>components/core/src/clp/clp/CMakeLists.txt<br>components/core/src/clp/make_dictionaries_readable/CMakeLists.txt<br>components/core/src/clp_s/indexer/CMakeLists.txt<br>components/core/src/glt/glt/CMakeLists.txt<br>components/core/src/reducer/CMakeLists.txt | Wrapped executable target creation and configuration in `if(CLP_BUILD_EXECUTABLES)` blocks to allow optional binary builds. |
| components/core/src/clp/regex_utils/CMakeLists.txt                                               | Wrapped `regex_utils` library creation/configuration in `if(CLP_BUILD_CLP_REGEX_UTILS)` block.                             |
| components/core/src/clp/string_utils/CMakeLists.txt                                              | Wrapped `string_utils` library creation/configuration in `if(CLP_BUILD_CLP_STRING_UTILS)` block.                           |
| components/core/src/clp_s/CMakeLists.txt                                                         | Wrapped each library and executable target in component-specific `if(CLP_BUILD_*)` conditionals for selective builds.       |
| components/core/src/clp_s/search/CMakeLists.txt                                                  | Wrapped `clp_s_search` library creation/configuration in `if(CLP_BUILD_CLP_S_SEARCH)` block.                               |
| components/core/src/clp_s/search/ast/CMakeLists.txt                                              | Wrapped `clp_s_search_ast` library creation/configuration in `if(CLP_BUILD_CLP_S_SEARCH_AST)` block.                       |
| components/core/src/clp_s/search/kql/CMakeLists.txt                                              | Wrapped `clp_s_search_kql` library creation/configuration in `if(CLP_BUILD_CLP_S_SEARCH_KQL)` block.                       |
| components/core/src/clp_s/search/sql/CMakeLists.txt                                              | Wrapped `clp_s_search_sql` library creation/configuration in `if(CLP_BUILD_CLP_S_SEARCH_SQL)` block.                       |
| components/core/cmake/Options/options.cmake                                                     | Added new CMake options to control building of binaries, libraries, tests, and external dependencies with descriptive flags; includes validation and setup functions for dependency flags. |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant User
    participant CMake
    participant Dependency
    participant Target

    User->>CMake: Configure build with flags (e.g., CLP_BUILD_EXECUTABLES)
    CMake->>CMake: Validate and setup CLP_BUILD_* and CLP_NEED_* flags
    alt Dependency needed
        CMake->>Dependency: find_package(...)
        Dependency-->>CMake: Provide dependency
    else Dependency not needed
        CMake-->>Dependency: Skip find_package
    end
    alt Target build enabled
        CMake->>Target: add_executable/add_library(...)
    else Target build disabled
        CMake-->>Target: Skip target creation
    end

Possibly related PRs

Suggested reviewers

  • kirkrodrigues

<!-- walkthrough_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIBbHgvWgAKJn8ASi4AQVp6ADMvNCJkXFhqSBIADxoKDDRfXnwRMWQGTEhsRA8CSFokFUj0DHluZ1D8XLDYDziE2miUDFwKRWwGaXR7EjGJgGEAWTQAaw98wuQlRHgicnpuuq98AHdyqspa+uWm3GL8TcixSQkLzyXqIfoeJjMbj4ciLZDjSYQrzcBT+SAzRIaGAIZBkUoYNZsRblWoCSK4141Oo8T6ib5hX5Kbhkegw+zMhjwXLwBg8UbwiYMZGQR7qWD4PB+QLxCjwDBERELRC4e7UeBshFMllkTnrfwFGi3X7YDAdKKQ6Gw74aNxTSDkZ6nIroNG8EjcipRUUlSAAAx2ABkrAB9ABCAFUAJIBgAiwd9g3oTEWy18JQ8cqFHXVWARGNuzlI9Mw9C1GCUBPg0ixAFE0AxYGFC1sUMhHlRuMz6HLBn6uUlAyGI9G4xox2kE8neuIYQAaRPoHyIzqQJ3IZwQ+t2/DcGcYc7utDecTyhlhCjBedsTByhX3JsUIsyeKJdEgw/HrE7fAUfyIS29Ke/pBsGAByNY1nGAAaCZrgsvStDQIoIA2kBePAAhUC4PQkMy5Y6lW65ov4QTwP49ACGgnSslg6YPk+6IkLe6IvpokB1qhvrcuWwYjAwhyFCQk73qg7ZoJ2URyIq+okBImChMBIbgZBwYwauBQKt0ZAOGiMLAvaojSGC2FlhWupEScErljaBgAGI/uUW5+oOYZRrG8bqYU864I8vy5Ca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eGsEoimnakaAJwpWTRigxQYaAKpJFoECanZT2pq02jFoBowSAN0SiE4T3igxTTJALOJWRIBWmqkSgPeGgErICBakBp6KE4S9MMBKypp701adBiBmuTJAPeNaZug3QSAfpyslabQC1IboVSNGFUlyBVJHT7Z/MyoFqSWm1gtSJ02jAbNVJKypZ4M6abRimmnCVZqpPGbQDFmGAao906DFsVowboXp2pJOYYC0BvTqgUGLmfzPZwNS2ppwj2b3NVIbok55c04VEBOElAThGpLUlyALmGApp3IF6dNMMAnCrQJwrkFBiVl7zo5iAJABugnmezc57c0mdyB1m0ze8feOmaqSVJ0zup00wIBughn+zA5ysvlCPNAXTTlZfM7UlDOgxaAzZgQM2b3jFm0YU5t04+ci1WnaAGZ0GLqatOWmqzDFwCwKVNOOncgkZpwmgDXNWn8z8ZvczdFoC5B6LqgaKHvFguhnakL5tGE+crK1IOLPQK0+afqR7w1RMZgQG+aqTNj8LlZPSzxbQB4WnTtAI0wxbwsCA0Y4ZlS1BcrIxmkz5lgQAOZui+m94hl2pCQFvOFxkzDAGM15d1MKWYz/5lS3Gfotox+zOlw07ad4tUXKyoMfywID4u1InCy53IFmcrIMXRLNl7CzKa5OvnakXlrBDdDbMMAiriZ90ExYwvtn6zJAU0+OfbOmm/Taljy4efyvanmxuQKc8WZujenrzPp2gF5YtP9n7zDAFszWdNM3QGAiV1K+6czMlmcLUANALad9M9nKyWVts/WCtOaXUrJADMzUimuPnrzXFouBObRgxmrTKlmM9JdzMwxXTAgeiwxacJfmnCVp6s6hfNMMA3LoZq0xueavpmPAS1yALedaBVI0raVwuN1ZIDhmErKgRK3+dBhoxkrQ1ti99azhyWRzvJIM0BflNdQlT7uqjO0jyKCl9AQAA== -->

<!-- internal state end -->
<!-- tips_start -->

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=y-scope/clp&utm_content=955):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai explain this code block.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and explain its main purpose.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 15

🔭 Outside diff range comments (3)
components/core/src/clp_s/search/kql/CMakeLists.txt (1)

1-8: ⚠️ Potential issue

Wrap ANTLR_TARGET inside the disable flag

The ANTLR_TARGET invocation for KqlParser remains outside the if(NOT CLP_NO_BUILD_CLP_S_SEARCH_KQL) block, which still triggers grammar generation and antlr dependencies even when the library is disabled. To fully honour CLP_NO_BUILD_CLP_S_SEARCH_KQL, move the ANTLR_TARGET call inside the conditional.

components/core/src/clp_s/CMakeLists.txt (1)

387-422: 🧹 Nitpick (assertive)

Verify executable toggle documentation
The top-level clp-s executable is now wrapped in if(NOT CLP_NO_BUILD_BINARIES). Ensure:

  • CLP_NO_BUILD_BINARIES is declared and described via an option.
  • Consider logging the skip case in an else() block to aid debugging.
components/core/CMakeLists.txt (1)

713-758: 🧹 Nitpick (assertive)

Refactor and document test executable
Gating the unitTest executable under CLP_NO_BUILD_TESTS is appropriate. For maintainability:

  1. Declare option(CLP_NO_BUILD_TESTS "Disable building unit tests" OFF).
  2. Break the huge SOURCE_FILES_unitTest list into logical groups or use file(GLOB_RECURSE ...) patterns to reduce manual upkeep.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6d114b9 and 3bdb6f8.

📒 Files selected for processing (15)
  • components/core/CMakeLists.txt (4 hunks)
  • components/core/src/clp/clg/CMakeLists.txt (1 hunks)
  • components/core/src/clp/clo/CMakeLists.txt (1 hunks)
  • components/core/src/clp/clp/CMakeLists.txt (1 hunks)
  • components/core/src/clp/make_dictionaries_readable/CMakeLists.txt (1 hunks)
  • components/core/src/clp/regex_utils/CMakeLists.txt (1 hunks)
  • components/core/src/clp/string_utils/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/CMakeLists.txt (8 hunks)
  • components/core/src/clp_s/indexer/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/search/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/search/ast/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/search/kql/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/search/sql/CMakeLists.txt (1 hunks)
  • components/core/src/glt/glt/CMakeLists.txt (1 hunks)
  • components/core/src/reducer/CMakeLists.txt (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: ubuntu-jammy-lint
  • GitHub Check: centos-stream-9-static-linked-bins
  • GitHub Check: centos-stream-9-dynamic-linked-bins
  • GitHub Check: ubuntu-jammy-static-linked-bins
  • GitHub Check: ubuntu-jammy-dynamic-linked-bins
  • GitHub Check: lint-check (ubuntu-latest)
  • GitHub Check: lint-check (macos-latest)
  • GitHub Check: build-macos (macos-13, false)
  • GitHub Check: build-macos (macos-15, false)
  • GitHub Check: build-macos (macos-15, true)
  • GitHub Check: build-macos (macos-14, false)
🔇 Additional comments (9)
components/core/src/reducer/CMakeLists.txt (1)

41-61: Conditional build for reducer-server & per-target flag verification

The reducer-server executable is correctly guarded by if(NOT CLP_NO_BUILD_BINARIES), aligning with the global binary-disable pattern. According to the PR objectives, consider whether a finer-grained flag CLP_NO_BUILD_REDUCER_SERVER should also be provided to disable this specific target independently.

components/core/src/clp/make_dictionaries_readable/CMakeLists.txt (1)

42-60: Conditional build for make-dictionaries-readable & per-target flag verification

The make-dictionaries-readable target is now correctly enclosed in if(NOT CLP_NO_BUILD_BINARIES). Please confirm if a dedicated flag like CLP_NO_BUILD_MAKE_DICTIONARIES_READABLE is also desired for per-executable control, per the PR objectives.

components/core/src/clp/regex_utils/CMakeLists.txt (1)

8-28: Per-target disable for regex_utils library

The regex_utils library is properly wrapped in if(NOT CLP_NO_BUILD_CLP_REGEX_UTILS), providing the intended per-component build control. This aligns well with the new flag conventions.

components/core/src/clp_s/search/kql/CMakeLists.txt (1)

8-28: Conditional build for clp_s_search_kql library

The clp_s_search_kql target is correctly wrapped in if(NOT CLP_NO_BUILD_CLP_S_SEARCH_KQL), providing the intended fine-grained disable capability for this component.

components/core/src/clp_s/search/CMakeLists.txt (1)

31-49: Ensure CMake flag exists and aligns with naming conventions

The conditional wrap of clp_s_search within if(NOT CLP_NO_BUILD_CLP_S_SEARCH) is correct. Please verify that CLP_NO_BUILD_CLP_S_SEARCH is defined via option() with a clear description in the main build scripts and follows the established CLP_NO_BUILD_* naming convention.

components/core/src/clp/clg/CMakeLists.txt (1)

126-156: Confirm consistent behaviour for CLP_NO_BUILD_BINARIES

Wrapping the entire clg executable in if(NOT CLP_NO_BUILD_BINARIES) follows the PR’s design. Ensure that disabling this flag prevents all binaries (including clp, clo, etc.) from building and that the flag is declared and documented at the project root.

components/core/src/clp/clp/CMakeLists.txt (1)

168-200: Validate CLP_NO_BUILD_BINARIES gating for clp executable

The clp executable target is correctly enclosed in if(NOT CLP_NO_BUILD_BINARIES). Please confirm that this flag is consistently applied across all top-level executables and that disabling it cleanly omits all binaries (including clg, clo, etc.) without leaving orphaned build configuration.

components/core/CMakeLists.txt (2)

1-1: Confirm bump to CMake 3.21 is supported
Raising cmake_minimum_required to 3.21 unlocks newer features but may drop support for older CI images or developer environments. Please verify that all supported platforms (CI runners, Docker images, developer machines) provide at least CMake 3.21 and update documentation accordingly.


125-132: All other if(NOT CLP_NO_NEED_*) guards wrapping find_package calls consistently follow the intended pattern and require no further changes.

Also applies to: 135-145, 154-159, 161-166, 168-173, 175-180, 182-187, 189-194, 197-207, 211-218, 221-228, 231-242, 245-258, 261-268, 272-278, 280-284, 298-312, 314-319

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3bdb6f8 and 53d3e1b.

📒 Files selected for processing (2)
  • components/core/CMakeLists.txt (4 hunks)
  • components/core/cmake/Options/options.cmake (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: ubuntu-jammy-lint
  • GitHub Check: ubuntu-jammy-static-linked-bins
  • GitHub Check: ubuntu-jammy-dynamic-linked-bins
  • GitHub Check: centos-stream-9-dynamic-linked-bins
  • GitHub Check: centos-stream-9-static-linked-bins
  • GitHub Check: build-macos (macos-13, true)
  • GitHub Check: build-macos (macos-15, true)
  • GitHub Check: build-macos (macos-14, true)
  • GitHub Check: build-macos (macos-13, false)
  • GitHub Check: lint-check (ubuntu-latest)
  • GitHub Check: lint-check (macos-latest)
🔇 Additional comments (4)
components/core/cmake/Options/options.cmake (1)

1-91: Well-structured build toggles but verify usage of CLP_NO_BUILD_BINARIES
The build-target options are clearly organised with consistent naming and OFF-by-default semantics. However, I didn’t spot any guard for CLP_NO_BUILD_BINARIES in the top-level CMakeLists.txt; please confirm that this flag is actually honoured (either at the root or in submodule CMake files) or document where it’s consumed.

Could you verify that all executable targets respect CLP_NO_BUILD_BINARIES?

components/core/CMakeLists.txt (3)

1-1: Bumped minimum CMake version to 3.21; confirm CI compatibility
Upgrading to 3.21 is necessary for PROJECT_IS_TOP_LEVEL support, but please ensure all CI agents and supported platforms have CMake ≥3.21.

Can you confirm our build environments meet this requirement?


12-13: Options inclusion right after project() is spot on
Including options.cmake immediately after the project declaration guarantees all flags are available for downstream logic.


718-763: Test target guard is correctly scoped
The if(NOT CLP_NO_BUILD_TESTS) wrapping around the unitTest target and its dependencies neatly disables tests when desired. Well done.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 53d3e1b and e87511e.

📒 Files selected for processing (3)
  • components/core/CMakeLists.txt (4 hunks)
  • components/core/src/clp_s/search/kql/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/search/sql/CMakeLists.txt (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
components/core/src/clp_s/search/sql/CMakeLists.txt (1)
Learnt from: gibber9809
PR: y-scope/clp#955
File: components/core/src/clp_s/search/sql/CMakeLists.txt:8-26
Timestamp: 2025-06-02T18:22:24.060Z
Learning: In the clp project, ANTLR code generation at build time is being removed by another PR. When reviewing CMake files, be aware that some temporary suboptimal configurations may exist to reduce merge conflicts between concurrent PRs, especially around ANTLR_TARGET calls.
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: ubuntu-jammy-dynamic-linked-bins
  • GitHub Check: centos-stream-9-dynamic-linked-bins
  • GitHub Check: centos-stream-9-static-linked-bins
  • GitHub Check: ubuntu-jammy-static-linked-bins
  • GitHub Check: ubuntu-jammy-lint
  • GitHub Check: lint-check (ubuntu-latest)
🔇 Additional comments (6)
components/core/src/clp_s/search/kql/CMakeLists.txt (1)

14-37: Conditional guard added for optional build
Wrapping the clp_s_search_kql target and its related commands inside if(NOT CLP_NO_BUILD_CLP_S_SEARCH_KQL) correctly implements the new build‐time flag. Ensure that CLP_NO_BUILD_CLP_S_SEARCH_KQL is declared in options.cmake with a clear description so users can disable this component.

components/core/src/clp_s/search/sql/CMakeLists.txt (1)

14-36: Conditional guard added for optional build
The entire clp_s_search_sql library definition is now enclosed in if(NOT CLP_NO_BUILD_CLP_S_SEARCH_SQL), consistent with the PR’s goal of selective builds. Confirm that CLP_NO_BUILD_CLP_S_SEARCH_SQL is declared in options.cmake.

components/core/CMakeLists.txt (4)

1-1: Bumped minimum CMake version to 3.21
Updating cmake_minimum_required(VERSION 3.21) is necessary for PROJECT_IS_TOP_LEVEL and SOURCE_SUBDIR support. Verify that no downstream scripts or submodules rely on older CMake features.


12-13: Included centralized options file
Adding include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/Options/options.cmake") properly brings in all CLP_NO_BUILD_* and CLP_NO_NEED_* flags. Path and order look correct.


270-270: Always-on Threads dependency
Retaining find_package(Threads REQUIRED) without a guard aligns with the design choice that threading support is mandatory.


715-760: Guard for unit test target
Wrapping the unitTest executable in if(NOT CLP_NO_BUILD_TESTS) is correct. Ensure CLP_NO_BUILD_TESTS is declared in options.cmake (and documented) so external projects can disable all tests.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

🔭 Outside diff range comments (1)
components/core/CMakeLists.txt (1)

710-754: 🧹 Nitpick (assertive)

Suggest adding a skip message when tests are disabled
The if(NOT CLP_NO_BUILD_TESTS) block correctly gates the unitTest target. Add an else() branch with message(STATUS "Unit tests disabled by CLP_NO_BUILD_TESTS") to clarify when tests are skipped.

♻️ Duplicate comments (2)
components/core/src/clp/clo/CMakeLists.txt (1)

154-184: Guard clo executable with global binary-disable flag
The if(NOT CLP_NO_BUILD_BINARIES) wrapper properly scopes the clo target. Ensure the CLP_NO_BUILD_BINARIES option is declared in your centralized options file and documented for external users.

components/core/src/glt/glt/CMakeLists.txt (1)

174-203: ⚠️ Potential issue

Verify presence of CLP_NO_BUILD_BINARIES declaration
Without an option(CLP_NO_BUILD_BINARIES …) in your root or shared options file, this guard has no effect. Please confirm and add the option declaration if missing.
Apply this snippet in components/core/cmake/Options/options.cmake:

+option(CLP_NO_BUILD_BINARIES
+       "Disable building all CLP binaries"
+       OFF)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e87511e and 5737411.

📒 Files selected for processing (7)
  • components/core/CMakeLists.txt (4 hunks)
  • components/core/src/clp/clg/CMakeLists.txt (1 hunks)
  • components/core/src/clp/clo/CMakeLists.txt (1 hunks)
  • components/core/src/clp/clp/CMakeLists.txt (1 hunks)
  • components/core/src/clp/regex_utils/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/CMakeLists.txt (8 hunks)
  • components/core/src/glt/glt/CMakeLists.txt (1 hunks)
🔇 Additional comments (6)
components/core/src/clp/regex_utils/CMakeLists.txt (1)

8-27: Gate regex_utils library build on its flag
Wrapping the add_library(regex_utils …) block in if(NOT CLP_NO_BUILD_CLP_REGEX_UTILS) correctly enables optional exclusion of this component. Confirm that CLP_NO_BUILD_CLP_REGEX_UTILS is declared in components/core/cmake/Options/options.cmake and described in your build documentation.

components/core/src/clp/clp/CMakeLists.txt (1)

168-199: Wrap clp executable in binary-disable conditional
The if(NOT CLP_NO_BUILD_BINARIES) block correctly prevents building the clp target when the flag is set. Verify that downstream modules, installation rules, and dependent targets gracefully handle the absence of clp.

components/core/src/clp/clg/CMakeLists.txt (1)

126-156: Conditional build for clg executable
The if(NOT CLP_NO_BUILD_BINARIES) guard correctly scopes the clg target. Ensure this global flag’s behavior is communicated in your central build options and documentation.

components/core/CMakeLists.txt (3)

1-1: Approve minimum CMake version bump
Requiring CMake 3.21 aligns with the use of PROJECT_IS_TOP_LEVEL and SOURCE_SUBDIR features.


12-14: Approve inclusion of centralized build options
Including options.cmake early ensures all CLP_NO_* flags are declared before use in the configuration.


275-278: The ystdlib and sqlite toggle blocks appear correctly wrapped and use the intended subdirectory and dynamic‐library helper. No changes needed.

Also applies to: 311-314

Comment on lines 133 to 147
if(NOT CLP_NO_BUILD_CLP_S_REDUCER_DEPENDENCIES)
add_library(
clp_s_reducer_dependencies
${CLP_S_REDUCER_SOURCES}
)
add_library(clp_s::reducer_dependencies ALIAS clp_s_reducer_dependencies)
target_compile_features(clp_s_reducer_dependencies PRIVATE cxx_std_20)
target_link_libraries(
clp_s_reducer_dependencies
PUBLIC
nlohmann_json::nlohmann_json
PRIVATE
clp_s::clp_dependencies
)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Suggest adding a skip message when toggled off
Wrap the clp_s_reducer_dependencies block with an else() branch to log when CLP_NO_BUILD_CLP_S_REDUCER_DEPENDENCIES is set, improving build-time clarity.

🤖 Prompt for AI Agents
In components/core/src/clp_s/CMakeLists.txt around lines 133 to 147, the build
block for clp_s_reducer_dependencies lacks feedback when disabled. Add an else()
branch after the if(NOT CLP_NO_BUILD_CLP_S_REDUCER_DEPENDENCIES) condition that
outputs a message indicating the clp_s_reducer_dependencies build is skipped due
to the flag being set. Use CMake's message() function to log this information
for better build-time clarity.

Comment on lines 292 to 315
if(NOT CLP_NO_BUILD_CLP_S_ARCHIVEREADER)
add_library(
clp_s_archive_reader
${CLP_S_ARCHIVE_READER_SOURCES}
)
add_library(clp_s::archive_reader ALIAS clp_s_archive_reader)
target_compile_features(clp_s_archive_reader PRIVATE cxx_std_20)
target_include_directories(clp_s_archive_reader PUBLIC ../)
target_link_libraries(
clp_s_archive_reader
PUBLIC
absl::flat_hash_map
clp_s::io
nlohmann_json::nlohmann_json
PRIVATE
Boost::url
clp_s::clp_dependencies
clp_s::timestamp_pattern
${CURL_LIBRARIES}
fmt::fmt
msgpack-cxx
spdlog::spdlog
)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Suggest adding a skip message when toggled off
Enclose the clp_s_archive_reader block in an else() with a status message to indicate when CLP_NO_BUILD_CLP_S_ARCHIVEREADER prevents its build.

🤖 Prompt for AI Agents
In components/core/src/clp_s/CMakeLists.txt around lines 292 to 315, the build
block for clp_s_archive_reader lacks feedback when disabled by
CLP_NO_BUILD_CLP_S_ARCHIVEREADER. Add an else() clause after the existing if()
block that uses message(STATUS "...") to print a clear skip message indicating
the archive reader build is disabled. This will improve build transparency.

Comment on lines 382 to 412
if(NOT CLP_NO_BUILD_BINARIES)
add_executable(
clp-s
clp-s.cpp
${CLP_S_EXE_SOURCES}
)
target_compile_features(clp-s PRIVATE cxx_std_20)
target_link_libraries(
clp-s
PRIVATE
Boost::program_options
clp_s::archive_reader
clp_s::archive_writer
clp_s::clp_dependencies
clp_s::io
clp_s::json_constructor
clp_s::reducer_dependencies
clp_s::search
clp_s::search::ast
clp_s::search::kql
${MONGOCXX_TARGET}
msgpack-cxx
spdlog::spdlog
ystdlib::error_handling
)
set_target_properties(
clp-s
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}"
)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Suggest adding a skip message when toggled off
Include an else() branch for if(NOT CLP_NO_BUILD_BINARIES) to message(STATUS "clp-s executable build disabled") when binaries are turned off.

🤖 Prompt for AI Agents
In components/core/src/clp_s/CMakeLists.txt around lines 382 to 412, add an
else() branch to the existing if(NOT CLP_NO_BUILD_BINARIES) condition. Inside
this else() branch, insert a message(STATUS "clp-s executable build disabled")
statement to clearly indicate when the clp-s executable build is skipped due to
the CLP_NO_BUILD_BINARIES flag being set.

Comment on lines 169 to 186
if(NOT CLP_NO_BUILD_CLP_S_IO)
add_library(
clp_s_io
${CLP_S_IO_SOURCES}
)
add_library(clp_s::io ALIAS clp_s_io)
target_compile_features(clp_s_io PRIVATE cxx_std_20)
target_include_directories(clp_s_io PUBLIC ../)
target_link_libraries(
clp_s_io
PRIVATE
Boost::iostreams Boost::url
clp_s::clp_dependencies
fmt::fmt
spdlog::spdlog
ZStd::ZStd
)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Suggest adding a skip message when toggled off
Consider adding an else() branch after if(NOT CLP_NO_BUILD_CLP_S_IO) to output a status message when the IO library build is disabled.

🤖 Prompt for AI Agents
In components/core/src/clp_s/CMakeLists.txt around lines 169 to 186, add an
else() branch after the existing if(NOT CLP_NO_BUILD_CLP_S_IO) condition to
output a message indicating that the clp_s_io library build is skipped. Use the
message() command to print a clear status message when the build is disabled,
improving build output clarity.

Comment on lines 353 to 368
if(NOT CLP_NO_BUILD_CLP_S_TIMESTAMPPATTERN)
add_library(
clp_s_timestamp_pattern
${CLP_S_TIMESTAMP_PATTERN_SOURCES}
)
add_library(clp_s::timestamp_pattern ALIAS clp_s_timestamp_pattern)
target_compile_features(clp_s_timestamp_pattern PRIVATE cxx_std_20)
target_include_directories(clp_s_timestamp_pattern PUBLIC ../)
target_link_libraries(
clp_s_timestamp_pattern
PRIVATE
clp::string_utils
date::date
spdlog::spdlog
)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Suggest adding a skip message when toggled off
To improve UX, add an else() branch after if(NOT CLP_NO_BUILD_CLP_S_TIMESTAMPPATTERN) that emits a status message when the timestamp pattern library is skipped.

🤖 Prompt for AI Agents
In components/core/src/clp_s/CMakeLists.txt around lines 353 to 368, add an
else() branch after the existing if(NOT CLP_NO_BUILD_CLP_S_TIMESTAMPPATTERN)
block. Inside this else() branch, use the message() command to output a status
message indicating that the clp_s_timestamp_pattern library build is being
skipped. This will improve user experience by clearly communicating when the
build option is disabled.

Comment on lines 325 to 342
if(NOT CLP_NO_BUILD_CLP_S_JSONCONSTRUCTOR)
add_library(
clp_s_json_constructor
${CLP_S_JSON_CONSTRUCTOR_SOURCES}
)
add_library(clp_s::json_constructor ALIAS clp_s_json_constructor)
target_compile_features(clp_s_json_constructor PRIVATE cxx_std_20)
target_include_directories(clp_s_json_constructor PUBLIC ../)
target_link_libraries(
clp_s_json_constructor
PUBLIC
clp_s::archive_reader
PRIVATE
fmt::fmt
${MONGOCXX_TARGET}
spdlog::spdlog
)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Suggest adding a skip message when toggled off
After the if(NOT CLP_NO_BUILD_CLP_S_JSONCONSTRUCTOR) block, include an else() branch that logs skipping the JSON constructor library.

🤖 Prompt for AI Agents
In components/core/src/clp_s/CMakeLists.txt around lines 325 to 342, add an
else() branch after the existing if(NOT CLP_NO_BUILD_CLP_S_JSONCONSTRUCTOR)
block. In this else() branch, include a message() command to log that the JSON
constructor library build is being skipped when
CLP_NO_BUILD_CLP_S_JSONCONSTRUCTOR is set. This will provide clear feedback
during the build process when the library is not built.

Comment on lines 84 to 106
if(NOT CLP_NO_BUILD_CLP_S_CLP_DEPENDENCIES)
add_library(
clp_s_clp_dependencies
${CLP_S_CLP_SOURCES}
)
add_library(clp_s::clp_dependencies ALIAS clp_s_clp_dependencies)
target_compile_features(clp_s_clp_dependencies PRIVATE cxx_std_20)
target_link_libraries(
clp_s_clp_dependencies
PUBLIC
clp::string_utils
ystdlib::containers
PRIVATE
Boost::regex
${CURL_LIBRARIES}
fmt::fmt
spdlog::spdlog
nlohmann_json::nlohmann_json
OpenSSL::Crypto
ystdlib::error_handling
ZStd::ZStd
)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Suggest adding a skip message when toggled off
Each if(NOT CLP_NO_BUILD_CLP_S_CLP_DEPENDENCIES) block correctly gates the target, but it’s helpful to include an else() branch with message(STATUS "... skipped ...") to inform users when it’s disabled.

🤖 Prompt for AI Agents
In components/core/src/clp_s/CMakeLists.txt between lines 84 and 106, the
conditional block that skips building clp_s_clp_dependencies when
CLP_NO_BUILD_CLP_S_CLP_DEPENDENCIES is set lacks user feedback. Add an else()
branch after the if block with a message(STATUS "... skipped ...") statement to
inform users that the clp_s_clp_dependencies target build is disabled, improving
build transparency.

Comment on lines 229 to 254
if(NOT CLP_NO_BUILD_CLP_S_ARCHIVEWRITER)
add_library(
clp_s_archive_writer
${CLP_S_ARCHIVE_WRITER_SOURCES}
)
add_library(clp_s::archive_writer ALIAS clp_s_archive_writer)
target_compile_features(clp_s_archive_writer PRIVATE cxx_std_20)
target_include_directories(clp_s_archive_writer PUBLIC ../)
target_link_libraries(
clp_s_archive_writer
PUBLIC
absl::flat_hash_map
clp_s::io
simdjson::simdjson
PRIVATE
Boost::url
clp_s::clp_dependencies
clp_s::timestamp_pattern
${CURL_LIBRARIES}
fmt::fmt
msgpack-cxx
nlohmann_json::nlohmann_json
spdlog::spdlog
)
endif()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Suggest adding a skip message when toggled off
The clp_s_archive_writer target is correctly guarded; add an else() branch to call message(STATUS "... skipped ...") for better feedback when disabled.

🤖 Prompt for AI Agents
In components/core/src/clp_s/CMakeLists.txt between lines 229 and 254, the build
of clp_s_archive_writer is conditionally disabled with if(NOT
CLP_NO_BUILD_CLP_S_ARCHIVEWRITER) but lacks feedback when skipped. Add an else()
branch after the endif() that calls message(STATUS "... skipped
clp_s_archive_writer ...") to provide clear status output when this target is
not built.

Comment on lines 295 to 308
if(NOT CLP_NO_NEED_LZMA)
if(CLP_USE_STATIC_LIBS)
set(LIBLZMA_USE_STATIC_LIBS ON)
endif()
find_package(LibLZMA REQUIRED)
if(LIBLZMA_FOUND)
message(STATUS "Found Lzma ${LIBLZMA_VERSION_STRING}")
message(STATUS "Lzma library location: ${LIBLZMA_LIBRARIES}")
message(STATUS "Lzma Include Dir: ${LIBLZMA_INCLUDE_DIRS}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for Lzma")
endif()
include_directories(${LIBLZMA_INCLUDE_DIRS})
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Avoid global include_directories for LZMA
Using include_directories(${LIBLZMA_INCLUDE_DIRS}) pollutes all targets. Instead, attach include paths to the specific targets that need LZMA via target_include_directories(<target> PRIVATE ${LIBLZMA_INCLUDE_DIRS}).

🤖 Prompt for AI Agents
In components/core/CMakeLists.txt around lines 295 to 308, the use of
include_directories(${LIBLZMA_INCLUDE_DIRS}) applies the LZMA include paths
globally, which can cause unwanted side effects. To fix this, remove the global
include_directories call and instead add the LZMA include directories
specifically to the targets that require LZMA using
target_include_directories(<target> PRIVATE ${LIBLZMA_INCLUDE_DIRS}). Identify
the relevant targets and update their include directories accordingly.

Comment on lines 119 to 272
if(NOT CLP_NO_NEED_ABSL)
find_package(absl REQUIRED)
if (absl_FOUND)
message(STATUS "Found absl ${absl_VERSION}")
endif()
endif()

# Find and setup ANTLR Library
find_package(antlr4-runtime REQUIRED)
if (antlr4-runtime_FOUND)
message(STATUS "Found antlr4-runtime ${antlr4-runtime_VERSION}")
if(NOT CLP_NO_NEED_ANTLR)
find_package(antlr4-runtime REQUIRED)
if (antlr4-runtime_FOUND)
message(STATUS "Found antlr4-runtime ${antlr4-runtime_VERSION}")
endif()
endif()

# Find and setup Boost Library
if(CLP_USE_STATIC_LIBS)
set(Boost_USE_STATIC_LIBS ON)
endif()
find_package(Boost 1.81 REQUIRED iostreams program_options filesystem system regex url)
if(Boost_FOUND)
message(STATUS "Found Boost ${Boost_VERSION}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for Boost")
if(NOT CLP_NO_NEED_BOOST)
if(CLP_USE_STATIC_LIBS)
set(Boost_USE_STATIC_LIBS ON)
endif()
find_package(Boost 1.81 REQUIRED iostreams program_options filesystem system regex url)
if(Boost_FOUND)
message(STATUS "Found Boost ${Boost_VERSION}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for Boost")
endif()
endif()

find_package(Catch2 REQUIRED)
if (Catch2_FOUND)
message(STATUS "Found Catch2 ${Catch2_VERSION}")
if(NOT CLP_NO_BUILD_TESTS)
find_package(Catch2 REQUIRED)
if (Catch2_FOUND)
message(STATUS "Found Catch2 ${Catch2_VERSION}")
endif()
endif()

find_package(date REQUIRED)
if (date_FOUND)
message(STATUS "Found date ${date_VERSION}")
if(NOT CLP_NO_NEED_DATE)
find_package(date REQUIRED)
if (date_FOUND)
message(STATUS "Found date ${date_VERSION}")
endif()
endif()

find_package(fmt REQUIRED)
if(fmt_FOUND)
message(STATUS "Found fmt ${fmt_VERSION}")
if(NOT CLP_NO_NEED_FMT)
find_package(fmt REQUIRED)
if(fmt_FOUND)
message(STATUS "Found fmt ${fmt_VERSION}")
endif()
endif()

find_package(log_surgeon REQUIRED)
if(log_surgeon_FOUND)
message(STATUS "Found log_surgeon ${log_surgeon_VERSION}")
if(NOT CLP_NO_NEED_LOG_SURGEON)
find_package(log_surgeon REQUIRED)
if(log_surgeon_FOUND)
message(STATUS "Found log_surgeon ${log_surgeon_VERSION}")
endif()
endif()

find_package(nlohmann_json REQUIRED)
if(nlohmann_json_FOUND)
message(STATUS "Found nlohmann_json ${nlohmann_json_VERSION}")
if(NOT CLP_NO_NEED_NLOHMANN_JSON)
find_package(nlohmann_json REQUIRED)
if(nlohmann_json_FOUND)
message(STATUS "Found nlohmann_json ${nlohmann_json_VERSION}")
endif()
endif()

find_package(simdjson REQUIRED)
if(simdjson_FOUND)
message(STATUS "Found simdjson ${simdjson_VERSION}")
if(NOT CLP_NO_NEED_SIMDJSON)
find_package(simdjson REQUIRED)
if(simdjson_FOUND)
message(STATUS "Found simdjson ${simdjson_VERSION}")
endif()
endif()

find_package(spdlog REQUIRED)
if(spdlog_FOUND)
message(STATUS "Found spdlog ${spdlog_VERSION}")
if(NOT CLP_NO_NEED_SPDLOG)
find_package(spdlog REQUIRED)
if(spdlog_FOUND)
message(STATUS "Found spdlog ${spdlog_VERSION}")
endif()
endif()

# Find and setup libarchive
if(CLP_USE_STATIC_LIBS)
set(LibArchive_USE_STATIC_LIBS ON)
endif()
find_package(LibArchive REQUIRED)
if(LibArchive_FOUND)
message(STATUS "Found LibArchive ${LibArchive_VERSION}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for LibArchive")
if(NOT CLP_NO_NEED_LIBARCHIVE)
if(CLP_USE_STATIC_LIBS)
set(LibArchive_USE_STATIC_LIBS ON)
endif()
find_package(LibArchive REQUIRED)
if(LibArchive_FOUND)
message(STATUS "Found LibArchive ${LibArchive_VERSION}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for LibArchive")
endif()
endif()

# Find and setup libcurl
# By default, CURL does not provide static libraries
find_package(CURL 7.68.0 REQUIRED)
if(CURL_FOUND)
message(STATUS "Found CURL ${CURL_VERSION_STRING}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for CURL")
if(NOT CLP_NO_NEED_CURL)
find_package(CURL 7.68.0 REQUIRED)
if(CURL_FOUND)
message(STATUS "Found CURL ${CURL_VERSION_STRING}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for CURL")
endif()
endif()

# Find OpenSSL
find_package(OpenSSL REQUIRED)
if (OPENSSL_FOUND)
message(STATUS "Found OpenSSL (${OPENSSL_VERSION})")
else ()
message(FATAL_ERROR "OpenSSL not found")
endif ()
if(NOT CLP_NO_NEED_OPENSSL)
find_package(OpenSSL REQUIRED)
if(OPENSSL_FOUND)
message(STATUS "Found OpenSSL (${OPENSSL_VERSION})")
else()
message(FATAL_ERROR "OpenSSL not found")
endif()
endif()

# Find and setup MariaDBClient library
if(CLP_USE_STATIC_LIBS)
# NOTE: We can't statically link to MariaDBClient since it's GPL
message(AUTHOR_WARNING "MariaDBClient cannot be statically linked due to its license.")
endif()
find_package(MariaDBClient 3.1.0 REQUIRED)
if(MariaDBClient_FOUND)
message(STATUS "Found MariaDBClient ${MariaDBClient_VERSION}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for MariaDBClient")
if(NOT CLP_NO_NEED_MARIADB)
if(CLP_USE_STATIC_LIBS)
# NOTE: We can't statically link to MariaDBClient since it's GPL
message(AUTHOR_WARNING "MariaDBClient cannot be statically linked due to its license.")
endif()
find_package(MariaDBClient 3.1.0 REQUIRED)
if(MariaDBClient_FOUND)
message(STATUS "Found MariaDBClient ${MariaDBClient_VERSION}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for MariaDBClient")
endif()
endif()

# Find and setup mongocxx
find_package(mongocxx REQUIRED)
message(STATUS "Found mongocxx ${mongocxx_VERSION}")
if(CLP_USE_STATIC_LIBS)
set(MONGOCXX_TARGET mongo::mongocxx_static)
else()
set(MONGOCXX_TARGET mongo::mongocxx_shared)
if(NOT CLP_NO_NEED_MONGOCXX)
find_package(mongocxx REQUIRED)
message(STATUS "Found mongocxx ${mongocxx_VERSION}")
if(CLP_USE_STATIC_LIBS)
set(MONGOCXX_TARGET mongo::mongocxx_static)
else()
set(MONGOCXX_TARGET mongo::mongocxx_shared)
endif()
endif()

# Find and setup msgpack
find_package(msgpack-cxx 7.0.0 REQUIRED)
if(msgpack-cxx_FOUND)
message(STATUS "Found msgpack-cxx ${msgpack-cxx_VERSION}")
else()
message(FATAL_ERROR "Could not find msgpack-cxx")
if(NOT CLP_NO_NEED_MSGPACKCXX)
find_package(msgpack-cxx 7.0.0 REQUIRED)
if(msgpack-cxx_FOUND)
message(STATUS "Found msgpack-cxx ${msgpack-cxx_VERSION}")
else()
message(FATAL_ERROR "Could not find msgpack-cxx")
endif()
endif()

find_package(Threads REQUIRED)

find_package(yaml-cpp REQUIRED)
if(yaml-cpp_FOUND)
message(STATUS "Found yaml-cpp ${yaml-cpp_VERSION}")
if(NOT CLP_NO_NEED_YAMLCPP)
find_package(yaml-cpp REQUIRED)
if(yaml-cpp_FOUND)
message(STATUS "Found yaml-cpp ${yaml-cpp_VERSION}")
endif()
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

DRY up repetitive find_package guards with a helper macro
The pattern of if(NOT CLP_NO_NEED_…) wrapping each find_package block is consistent but verbose. Define a macro (e.g., clp_find_dependency(name, components)) in options.cmake to encapsulate the guard, find_package, and status message, then replace individual blocks with calls to that macro.

🤖 Prompt for AI Agents
In components/core/CMakeLists.txt from lines 119 to 272, the repeated pattern of
wrapping each find_package call with if(NOT CLP_NO_NEED_…) guards and status
messages is verbose. To fix this, define a macro named clp_find_dependency in
options.cmake that takes the package name and optional components, performs the
if guard, calls find_package with REQUIRED, and prints the status message if
found. Then replace each individual guarded find_package block in this file with
calls to this macro, passing the appropriate package name and components, to DRY
up the code and reduce repetition.

Copy link
Member

@wraymo wraymo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we're giving the user too much flexibility by allowing them to enable or disable every dependency individually. Is there a clean approach where we can handle dependency resolution ourselves — for example, by automatically including only the dependencies required by the targets the user selects?

PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}"
)
if(NOT CLP_NO_BUILD_BINARIES)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to control each individual binary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it could be worthwhile. I think it doesn't matter for the immediate use-case (exposing enough options so that external projects can pull in individual libraries without needing to pull in all of our targets and dependencies), but it could be useful e.g. to create more targeted installs of clp.

@gibber9809
Copy link
Contributor Author

I'm not sure if we're giving the user too much flexibility by allowing them to enable or disable every dependency individually. Is there a clean approach where we can handle dependency resolution ourselves — for example, by automatically including only the dependencies required by the targets the user selects?

I don't think cmake has functionality to do this automatically for the ExternalProject_Add and related flows unfortunately, at least not that I could find. We could of course add some higher level flags to request certain components and then use those flags to set all of these lower level flags, but that wouldn't be trivial to implement/maintain.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
components/core/CMakeLists.txt (1)

295-308: Avoid global include_directories
Using include_directories(${LIBLZMA_INCLUDE_DIRS}) applies LZMA headers to every target. Switch to target-specific imports:

-   include_directories(${LIBLZMA_INCLUDE_DIRS})
+   target_include_directories(<your_target> PRIVATE ${LIBLZMA_INCLUDE_DIRS})
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5737411 and 40b2491.

📒 Files selected for processing (2)
  • components/core/CMakeLists.txt (4 hunks)
  • components/core/src/clp_s/search/CMakeLists.txt (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: centos-stream-9-static-linked-bins
  • GitHub Check: centos-stream-9-dynamic-linked-bins
  • GitHub Check: ubuntu-jammy-dynamic-linked-bins
  • GitHub Check: ubuntu-jammy-static-linked-bins
  • GitHub Check: ubuntu-jammy-lint
  • GitHub Check: build-macos (macos-15, false)
  • GitHub Check: build-macos (macos-15, true)
  • GitHub Check: build-macos (macos-13, true)
  • GitHub Check: build (macos-latest)
  • GitHub Check: lint-check (macos-latest)
  • GitHub Check: lint-check (ubuntu-latest)
🔇 Additional comments (4)
components/core/src/clp_s/search/CMakeLists.txt (1)

33-52: Conditional build guard applied correctly
Wrapping the entire clp_s_search target definition in if(NOT CLP_NO_BUILD_CLP_S_SEARCH) ensures users can disable this library. Verify that the corresponding option is declared in options.cmake.

Please confirm that you have:

  • option(CLP_NO_BUILD_CLP_S_SEARCH "Disable building the clp_s_search library" OFF) in your options file.
  • Updated documentation to note the presence of this new flag.
components/core/CMakeLists.txt (3)

1-1: Bumped minimum CMake version
Updating to 3.21 aligns with the use of PROJECT_IS_TOP_LEVEL and SOURCE_SUBDIR.


12-13: Include centralized options early
Loading options.cmake before any targets ensures all CLP_NO_* toggles are available throughout the build.


712-756: Test target conditional is correct
Enclosing the large unitTest target in if(NOT CLP_NO_BUILD_TESTS) respects the new test toggle. Ensure CLP_NO_BUILD_TESTS is declared and documented in options.cmake.

Comment on lines 119 to 124
if(NOT CLP_NO_NEED_ABSL)
find_package(absl REQUIRED)
if (absl_FOUND)
message(STATUS "Found absl ${absl_VERSION}")
endif()
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

DRY opportunity: consolidate dependency guards
The repeated pattern:

if(NOT CLP_NO_NEED_ABSL)
  find_package(absl REQUIRED)
  …
endif()

occurs throughout. Consider defining a helper macro (e.g. clp_find_dependency(name, components)) in options.cmake to reduce boilerplate.

🤖 Prompt for AI Agents
In components/core/CMakeLists.txt around lines 119 to 124, there is repetitive
code for checking and finding dependencies like absl guarded by conditions such
as NOT CLP_NO_NEED_ABSL. To fix this, create a helper macro named
clp_find_dependency in options.cmake that takes the dependency name and
components as parameters, encapsulating the conditional find_package logic. Then
replace all repeated patterns in CMakeLists.txt with calls to this macro to
reduce boilerplate and improve maintainability.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

♻️ Duplicate comments (3)
components/core/src/clp/clo/CMakeLists.txt (1)

154-184: Duplicate: Confirm declaration and documentation of CLP_BUILD_BINARIES
This guard depends on an option (inverted from CLP_NO_BUILD_BINARIES)—ensure CLP_BUILD_BINARIES is defined via option(...) in components/core/cmake/Options/options.cmake with a clear description and default ON. Without it, consumers can’t toggle binary builds.

Shell script to verify:

#!/bin/bash
# Check for option declaration of CLP_NO_BUILD_BINARIES and CLP_BUILD_BINARIES
rg -n "option\(\s*CLP_NO_BUILD_BINARIES" components/core/cmake/Options/options.cmake
rg -n "option\(\s*CLP_BUILD_BINARIES" components/core/cmake/Options/options.cmake
components/core/src/clp/string_utils/CMakeLists.txt (1)

5-14: Duplicate: Verify option declaration for CLP_BUILD_CLP_STRING_UTILS
Ensure CLP_BUILD_CLP_STRING_UTILS is defined via option(...) in components/core/cmake/Options/options.cmake with a descriptive help string and default ON, so consumers can toggle string_utils builds.

Shell script:

#!/bin/bash
rg -n "option\(\s*CLP_BUILD_CLP_STRING_UTILS" components/core/cmake/Options/options.cmake
components/core/src/clp_s/indexer/CMakeLists.txt (1)

83-108: Duplicate: Confirm CLP_BUILD_BINARIES option usage
The indexer executable is wrapped in if(CLP_BUILD_BINARIES)—verify the corresponding option (inverted from CLP_NO_BUILD_BINARIES) is declared and documented in components/core/cmake/Options/options.cmake.

Shell script:

#!/bin/bash
rg -n "option\(\s*CLP_NO_BUILD_BINARIES" components/core/cmake/Options/options.cmake
rg -n "option\(\s*CLP_BUILD_BINARIES"    components/core/cmake/Options/options.cmake
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 40b2491 and 1400ba5.

📒 Files selected for processing (16)
  • components/core/CMakeLists.txt (4 hunks)
  • components/core/cmake/Options/options.cmake (1 hunks)
  • components/core/src/clp/clg/CMakeLists.txt (1 hunks)
  • components/core/src/clp/clo/CMakeLists.txt (1 hunks)
  • components/core/src/clp/clp/CMakeLists.txt (1 hunks)
  • components/core/src/clp/make_dictionaries_readable/CMakeLists.txt (1 hunks)
  • components/core/src/clp/regex_utils/CMakeLists.txt (1 hunks)
  • components/core/src/clp/string_utils/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/CMakeLists.txt (8 hunks)
  • components/core/src/clp_s/indexer/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/search/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/search/ast/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/search/kql/CMakeLists.txt (1 hunks)
  • components/core/src/clp_s/search/sql/CMakeLists.txt (1 hunks)
  • components/core/src/glt/glt/CMakeLists.txt (1 hunks)
  • components/core/src/reducer/CMakeLists.txt (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
components/core/src/clp_s/search/sql/CMakeLists.txt (1)
Learnt from: gibber9809
PR: y-scope/clp#955
File: components/core/src/clp_s/search/sql/CMakeLists.txt:8-26
Timestamp: 2025-06-02T18:22:24.060Z
Learning: In the clp project, ANTLR code generation at build time is being removed by another PR. When reviewing CMake files, be aware that some temporary suboptimal configurations may exist to reduce merge conflicts between concurrent PRs, especially around ANTLR_TARGET calls.
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: build-macos (macos-15, true)
  • GitHub Check: build-macos (macos-14, false)
  • GitHub Check: build-macos (macos-15, false)
  • GitHub Check: build-macos (macos-13, true)
  • GitHub Check: lint-check (macos-latest)
  • GitHub Check: ubuntu-jammy-dynamic-linked-bins
  • GitHub Check: ubuntu-jammy-lint
  • GitHub Check: ubuntu-jammy-static-linked-bins
  • GitHub Check: centos-stream-9-dynamic-linked-bins
  • GitHub Check: centos-stream-9-static-linked-bins
🔇 Additional comments (14)
components/core/src/clp_s/search/CMakeLists.txt (1)

33-52: I couldn’t find CLP_BUILD_CLP_S_SEARCH declared in the central options file—let’s search the entire repo to verify its definition:

#!/bin/bash
# Search for any declaration or usage of the option
rg -n "CLP_BUILD_CLP_S_SEARCH" .
components/core/src/reducer/CMakeLists.txt (1)

41-61: ```shell
#!/bin/bash

Search for option declarations anywhere in the repo

rg -n 'option(.*CLP_BUILD_BINARIES' .
rg -n 'option(.*CLP_NO_BUILD_BINARIES' .

Fallback: look for any mentions of the variables

rg -n 'CLP_BUILD_BINARIES' .
rg -n 'CLP_NO_BUILD_BINARIES' .


</details>
<details>
<summary>components/core/src/clp_s/search/kql/CMakeLists.txt (1)</summary>

`14-37`: Let’s try a simpler search to locate the option definition:


```shell
#!/bin/bash
# 1) Look for any mention of the flag
grep -n 'CLP_BUILD_CLP_S_SEARCH_KQL' components/core/cmake/Options/options.cmake || true

# 2) Specifically try to find an option declaration
rg -n 'option.*CLP_BUILD_CLP_S_SEARCH_KQL' -A2 components/core/cmake/Options/options.cmake || true
components/core/src/clp/make_dictionaries_readable/CMakeLists.txt (1)

42-60: Gating make-dictionaries-readable behind CLP_BUILD_BINARIES is correct
The if(CLP_BUILD_BINARIES) block cleanly encapsulates all executable creation, compile features, linkage, and output settings.

components/core/src/clp/regex_utils/CMakeLists.txt (1)

8-27: Conditional build of regex_utils is correctly implemented
The if(CLP_BUILD_CLP_REGEX_UTILS) guard wraps the library definition, alias, include paths, compile features, and PUBLIC/PRIVATE linkage as expected.

components/core/src/clp_s/search/sql/CMakeLists.txt (1)

14-36: Optional inclusion of clp_s_search_sql looks good
All add_library, aliasing, compile features, include directories, and target linkage are scoped within if(CLP_BUILD_CLP_S_SEARCH_SQL) following the project’s pattern.

components/core/src/clp/clg/CMakeLists.txt (1)

126-157: Conditional build of clg executable is consistent
Wrapping the clg target in if(CLP_BUILD_BINARIES) aligns with other binaries. Include directories, compile features, and linked libraries are properly scoped.

components/core/src/clp_s/search/ast/CMakeLists.txt (1)

52-68: Conditional build guard for clp_s_search_ast is correct
Enclosing the library creation in if(CLP_BUILD_CLP_S_SEARCH_AST) aligns with the centralized options approach and enables optional builds without modifying source code.

components/core/src/glt/glt/CMakeLists.txt (1)

174-203: Guard glt executable with CLP_BUILD_BINARIES
The add_executable(glt ...) block has been properly wrapped in if(CLP_BUILD_BINARIES), giving external projects control over building this binary.

components/core/src/clp_s/CMakeLists.txt (1)

84-106: Consistent application of build flags for CLP-S subcomponents
All add_library and add_executable targets in this file are now correctly gated by their respective CLP_BUILD_* flags, enabling fine-grained control as per the PR objectives.

Also applies to: 133-147, 169-186, 229-253, 292-314, 325-342, 353-368, 382-412

components/core/CMakeLists.txt (4)

1-1: Bump minimum required CMake to 3.21
Updating to 3.21 is necessary for using PROJECT_IS_TOP_LEVEL and SOURCE_SUBDIR features.


12-14: Include centralized options file
options.cmake now holds all CLP_BUILD_* and CLP_NEED_* definitions, ensuring consistent flag declarations across the build.


15-17: Initialize and validate CLP flags
Calling validate_and_setup_all_clp_dependency_flags() and convert_clp_dependency_properties_to_variables() establishes the new flag-based workflow.


715-759: Conditional creation of unitTest target
The unitTest executable is correctly wrapped in if(CLP_BUILD_TESTS), allowing test builds to be disabled.

Comment on lines +122 to 319
if(CLP_NEED_ABSL)
find_package(absl REQUIRED)
if (absl_FOUND)
message(STATUS "Found absl ${absl_VERSION}")
endif()
endif()

# Find and setup ANTLR Library
find_package(antlr4-runtime REQUIRED)
if (antlr4-runtime_FOUND)
message(STATUS "Found antlr4-runtime ${antlr4-runtime_VERSION}")
if(CLP_NEED_ANTLR)
find_package(antlr4-runtime REQUIRED)
if (antlr4-runtime_FOUND)
message(STATUS "Found antlr4-runtime ${antlr4-runtime_VERSION}")
endif()
endif()

# Find and setup Boost Library
if(CLP_USE_STATIC_LIBS)
set(Boost_USE_STATIC_LIBS ON)
endif()
find_package(Boost 1.81 REQUIRED iostreams program_options filesystem system regex url)
if(Boost_FOUND)
message(STATUS "Found Boost ${Boost_VERSION}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for Boost")
if(CLP_NEED_BOOST)
if(CLP_USE_STATIC_LIBS)
set(Boost_USE_STATIC_LIBS ON)
endif()
find_package(Boost 1.81 REQUIRED iostreams program_options filesystem system regex url)
if(Boost_FOUND)
message(STATUS "Found Boost ${Boost_VERSION}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for Boost")
endif()
endif()

find_package(Catch2 REQUIRED)
if (Catch2_FOUND)
message(STATUS "Found Catch2 ${Catch2_VERSION}")
if(CLP_NEED_CATCH2)
find_package(Catch2 REQUIRED)
if (Catch2_FOUND)
message(STATUS "Found Catch2 ${Catch2_VERSION}")
endif()
endif()

find_package(date REQUIRED)
if (date_FOUND)
message(STATUS "Found date ${date_VERSION}")
if(CLP_NEED_DATE)
find_package(date REQUIRED)
if (date_FOUND)
message(STATUS "Found date ${date_VERSION}")
endif()
endif()

find_package(fmt REQUIRED)
if(fmt_FOUND)
message(STATUS "Found fmt ${fmt_VERSION}")
if(CLP_NEED_FMT)
find_package(fmt REQUIRED)
if(fmt_FOUND)
message(STATUS "Found fmt ${fmt_VERSION}")
endif()
endif()

find_package(log_surgeon REQUIRED)
if(log_surgeon_FOUND)
message(STATUS "Found log_surgeon ${log_surgeon_VERSION}")
if(CLP_NEED_LOG_SURGEON)
find_package(log_surgeon REQUIRED)
if(log_surgeon_FOUND)
message(STATUS "Found log_surgeon ${log_surgeon_VERSION}")
endif()
endif()

find_package(nlohmann_json REQUIRED)
if(nlohmann_json_FOUND)
message(STATUS "Found nlohmann_json ${nlohmann_json_VERSION}")
if(CLP_NEED_NLOHMANN_JSON)
find_package(nlohmann_json REQUIRED)
if(nlohmann_json_FOUND)
message(STATUS "Found nlohmann_json ${nlohmann_json_VERSION}")
endif()
endif()

find_package(simdjson REQUIRED)
if(simdjson_FOUND)
message(STATUS "Found simdjson ${simdjson_VERSION}")
if(CLP_NEED_SIMDJSON)
find_package(simdjson REQUIRED)
if(simdjson_FOUND)
message(STATUS "Found simdjson ${simdjson_VERSION}")
endif()
endif()

find_package(spdlog REQUIRED)
if(spdlog_FOUND)
message(STATUS "Found spdlog ${spdlog_VERSION}")
if(CLP_NEED_SPDLOG)
find_package(spdlog REQUIRED)
if(spdlog_FOUND)
message(STATUS "Found spdlog ${spdlog_VERSION}")
endif()
endif()

# Find and setup libarchive
if(CLP_USE_STATIC_LIBS)
set(LibArchive_USE_STATIC_LIBS ON)
endif()
find_package(LibArchive REQUIRED)
if(LibArchive_FOUND)
message(STATUS "Found LibArchive ${LibArchive_VERSION}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for LibArchive")
if(CLP_NEED_LIBARCHIVE)
if(CLP_USE_STATIC_LIBS)
set(LibArchive_USE_STATIC_LIBS ON)
endif()
find_package(LibArchive REQUIRED)
if(LibArchive_FOUND)
message(STATUS "Found LibArchive ${LibArchive_VERSION}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for LibArchive")
endif()
endif()

# Find and setup libcurl
# By default, CURL does not provide static libraries
find_package(CURL 7.68.0 REQUIRED)
if(CURL_FOUND)
message(STATUS "Found CURL ${CURL_VERSION_STRING}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for CURL")
if(CLP_NEED_CURL)
find_package(CURL 7.68.0 REQUIRED)
if(CURL_FOUND)
message(STATUS "Found CURL ${CURL_VERSION_STRING}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for CURL")
endif()
endif()

# Find OpenSSL
find_package(OpenSSL REQUIRED)
if (OPENSSL_FOUND)
message(STATUS "Found OpenSSL (${OPENSSL_VERSION})")
else ()
message(FATAL_ERROR "OpenSSL not found")
endif ()
if(CLP_NEED_OPENSSL)
find_package(OpenSSL REQUIRED)
if(OPENSSL_FOUND)
message(STATUS "Found OpenSSL (${OPENSSL_VERSION})")
else()
message(FATAL_ERROR "OpenSSL not found")
endif()
endif()

# Find and setup MariaDBClient library
if(CLP_USE_STATIC_LIBS)
# NOTE: We can't statically link to MariaDBClient since it's GPL
message(AUTHOR_WARNING "MariaDBClient cannot be statically linked due to its license.")
endif()
find_package(MariaDBClient 3.1.0 REQUIRED)
if(MariaDBClient_FOUND)
message(STATUS "Found MariaDBClient ${MariaDBClient_VERSION}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for MariaDBClient")
if(CLP_NEED_MARIADB)
if(CLP_USE_STATIC_LIBS)
# NOTE: We can't statically link to MariaDBClient since it's GPL
message(AUTHOR_WARNING "MariaDBClient cannot be statically linked due to its license.")
endif()
find_package(MariaDBClient 3.1.0 REQUIRED)
if(MariaDBClient_FOUND)
message(STATUS "Found MariaDBClient ${MariaDBClient_VERSION}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for MariaDBClient")
endif()
endif()

# Find and setup mongocxx
find_package(mongocxx REQUIRED)
message(STATUS "Found mongocxx ${mongocxx_VERSION}")
if(CLP_USE_STATIC_LIBS)
set(MONGOCXX_TARGET mongo::mongocxx_static)
else()
set(MONGOCXX_TARGET mongo::mongocxx_shared)
if(CLP_NEED_MONGOCXX)
find_package(mongocxx REQUIRED)
message(STATUS "Found mongocxx ${mongocxx_VERSION}")
if(CLP_USE_STATIC_LIBS)
set(MONGOCXX_TARGET mongo::mongocxx_static)
else()
set(MONGOCXX_TARGET mongo::mongocxx_shared)
endif()
endif()

# Find and setup msgpack
find_package(msgpack-cxx 7.0.0 REQUIRED)
if(msgpack-cxx_FOUND)
message(STATUS "Found msgpack-cxx ${msgpack-cxx_VERSION}")
else()
message(FATAL_ERROR "Could not find msgpack-cxx")
if(CLP_NEED_MSGPACKCXX)
find_package(msgpack-cxx 7.0.0 REQUIRED)
if(msgpack-cxx_FOUND)
message(STATUS "Found msgpack-cxx ${msgpack-cxx_VERSION}")
else()
message(FATAL_ERROR "Could not find msgpack-cxx")
endif()
endif()

find_package(Threads REQUIRED)

find_package(yaml-cpp REQUIRED)
if(yaml-cpp_FOUND)
message(STATUS "Found yaml-cpp ${yaml-cpp_VERSION}")
if(CLP_NEED_YAMLCPP)
find_package(yaml-cpp REQUIRED)
if(yaml-cpp_FOUND)
message(STATUS "Found yaml-cpp ${yaml-cpp_VERSION}")
endif()
endif()

# Add ystdlib
set(YSTDLIB_CPP_BUILD_TESTING OFF)
add_subdirectory("${CLP_YSTDLIB_SOURCE_DIRECTORY}" "${CMAKE_BINARY_DIR}/ystdlib" EXCLUDE_FROM_ALL)
if(CLP_NEED_YSTDLIB)
set(YSTDLIB_CPP_BUILD_TESTING OFF)
add_subdirectory("${CLP_YSTDLIB_SOURCE_DIRECTORY}" "${CMAKE_BINARY_DIR}/ystdlib" EXCLUDE_FROM_ALL)
endif()

# Find and setup ZStd Library
if(CLP_USE_STATIC_LIBS)
set(ZStd_USE_STATIC_LIBS ON)
endif()
find_package(ZStd 1.4.4 REQUIRED)
if(ZStd_FOUND)
message(STATUS "Found ZStd ${ZStd_VERSION}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for ZStd")
if(CLP_NEED_ZSTD)
if(CLP_USE_STATIC_LIBS)
set(ZStd_USE_STATIC_LIBS ON)
endif()
find_package(ZStd 1.4.4 REQUIRED)
if(ZStd_FOUND)
message(STATUS "Found ZStd ${ZStd_VERSION}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for ZStd")
endif()
endif()

# Find and setup LZMA Library
# TODO: Add a script in ./cmake/Modules to properly import LZMA in find_package()'s module mode
if(CLP_USE_STATIC_LIBS)
set(LIBLZMA_USE_STATIC_LIBS ON)
endif()
find_package(LibLZMA REQUIRED)
if(LIBLZMA_FOUND)
message(STATUS "Found Lzma ${LIBLZMA_VERSION_STRING}")
message(STATUS "Lzma library location: ${LIBLZMA_LIBRARIES}")
message(STATUS "Lzma Include Dir: ${LIBLZMA_INCLUDE_DIRS}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for Lzma")
if(CLP_NEED_LZMA)
if(CLP_USE_STATIC_LIBS)
set(LIBLZMA_USE_STATIC_LIBS ON)
endif()
find_package(LibLZMA REQUIRED)
if(LIBLZMA_FOUND)
message(STATUS "Found Lzma ${LIBLZMA_VERSION_STRING}")
message(STATUS "Lzma library location: ${LIBLZMA_LIBRARIES}")
message(STATUS "Lzma Include Dir: ${LIBLZMA_INCLUDE_DIRS}")
else()
message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for Lzma")
endif()
include_directories(${LIBLZMA_INCLUDE_DIRS})
endif()
include_directories(${LIBLZMA_INCLUDE_DIRS})

# sqlite dependencies
set(sqlite_DYNAMIC_LIBS "dl;m;pthread")
include(cmake/Modules/FindLibraryDependencies.cmake)
FindDynamicLibraryDependencies(sqlite "${sqlite_DYNAMIC_LIBS}")
if(CLP_NEED_SQLITE)
set(sqlite_DYNAMIC_LIBS "dl;m;pthread")
include(cmake/Modules/FindLibraryDependencies.cmake)
FindDynamicLibraryDependencies(sqlite "${sqlite_DYNAMIC_LIBS}")
endif()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Guard external dependency resolution with flags
Every find_package call is now wrapped in if(CLP_NEED_*), preventing unnecessary dependency discovery and aligning with the PR’s goal of minimal external requirements.

Consider defining a helper macro in options.cmake (e.g., clp_find_dependency(name, components)) to DRY up repetitive guard + find_package blocks.

🤖 Prompt for AI Agents
In components/core/CMakeLists.txt from lines 122 to 319, the code wraps each
find_package call with a CLP_NEED_* guard to conditionally include dependencies.
To improve maintainability and reduce repetition, define a helper macro in
options.cmake named clp_find_dependency that takes the package name and optional
components, and internally performs the if guard and find_package call. Then
replace each guarded find_package block with calls to this macro, passing the
appropriate arguments, to DRY up the code and keep consistent conditional
dependency resolution.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 76c603d and e7a8f1b.

📒 Files selected for processing (1)
  • components/core/cmake/Options/options.cmake (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: ubuntu-jammy-static-linked-bins
  • GitHub Check: ubuntu-jammy-dynamic-linked-bins
  • GitHub Check: ubuntu-jammy-lint
  • GitHub Check: centos-stream-9-static-linked-bins
  • GitHub Check: centos-stream-9-dynamic-linked-bins
  • GitHub Check: build-macos (macos-15, false)
  • GitHub Check: build-macos (macos-15, true)
  • GitHub Check: build-macos (macos-14, true)
  • GitHub Check: build-macos (macos-13, false)
  • GitHub Check: lint-check (macos-latest)
  • GitHub Check: lint-check (ubuntu-latest)
🔇 Additional comments (3)
components/core/cmake/Options/options.cmake (3)

1-91: Well-structured build target options.

The option declarations follow a consistent naming convention and logical hierarchy. Defaulting all options to ON provides good backward compatibility while enabling selective component disabling for external projects.


376-448: Excellent coordination function design.

The master function provides a clean, systematic approach to dependency validation and setup. The conditional structure ensures efficient processing of only enabled targets, and the explanatory comment about clp::string_utils having no dependencies adds helpful clarity.


450-493: Conversion function correctly implemented.

The function properly uses the get_property/set pattern with PARENT_SCOPE to expose dependency flags as variables. The alphabetical ordering and consistent structure make it maintainable and easy to verify completeness.

@gibber9809 gibber9809 requested a review from wraymo June 18, 2025 18:38
@kirkrodrigues
Copy link
Member

For convenience we wrapp all of the validate/set functions in a function called validate_and_setup_all_clp_dependency_flags. To allow flags set inside of these functions to be exposed as variables to the caller users need to follow a call to that function with convert_clp_dependency_properties_to_variables.

I'm probably missing something---why do we need convert_clp_dependency_properties_to_variables rather than setting the variables directly (instead of setting properties first)?

@gibber9809
Copy link
Contributor Author

Thinking about it, I think there's a cleaner approach to achieve the goals of this PR:

* For each CMake target, define the list of `CLP_BUILD_` options it requires

* If a target's `CLP_BUILD_` option is set, iterate over each each target's dependent options to check if each one is set

* Move the required `find_package` calls for each target into the target's CMake list so that the `NEED_` flag tracking will be done automatically.
  
  * To ensure we still use a consistent of external dependency versions and options, we can define these in the root CMakeLists.txt.
  * Calling `find_package` multiple times should be fine as long the library's CMake configure script is written correctly.

That said, since this PR is blocking other PRs, let's defer the above to another PR (ideally, immediately after this one is merged).

Inline I left some comments about missing internal/external dependencies. If the omissions weren't intentional, can you recheck all of the dependencies?

Does moving the find_package calls work for something like boost though where we depend on many different components of a package? I'm not sure, but I think it might just use the list of components from the first find_package call for boost, which could cause problems if we use different lists of components in different find_package calls.

@gibber9809 gibber9809 requested a review from kirkrodrigues June 23, 2025 17:49
Comment on lines 173 to 174
CLP_NEED_LOG_SURGEON
CLP_NEED_LIBARCHIVE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CLP_NEED_LOG_SURGEON
CLP_NEED_LIBARCHIVE
CLP_NEED_LIBARCHIVE
CLP_NEED_LOG_SURGEON

set_clp_need_flags(
CLP_NEED_BOOST
CLP_NEED_FMT
CLP_NEED_MSGPACKCXX
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be missing something, but is this required? I don't see it in target_link_libs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right -- missed that one as well.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 828843e and 4dca942.

📒 Files selected for processing (2)
  • components/core/cmake/Options/options.cmake (1 hunks)
  • components/core/src/clp_s/CMakeLists.txt (8 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: filter-relevant-changes
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: lint-check (ubuntu-latest)
  • GitHub Check: lint-check (macos-latest)
🔇 Additional comments (6)
components/core/src/clp_s/CMakeLists.txt (1)

84-106: LGTM: Conditional building properly implemented.

All library and executable targets are correctly wrapped with their respective build flags, enabling selective component compilation. The implementation is consistent and follows the established pattern.

Also applies to: 133-147, 169-186, 229-253, 292-315, 325-342, 353-368, 382-412

components/core/cmake/Options/options.cmake (5)

1-90: LGTM: Comprehensive build options definition.

The build options are well-organized, consistently named, and provide appropriate descriptions. The alphabetical organization within logical groupings makes the file maintainable.


92-106: LGTM: Robust dependency validation function.

The validation logic properly checks that required dependencies are enabled and provides clear error messages. The parameter validation ensures the function is called correctly.


108-115: LGTM: Clean implementation for setting dependency flags.

The helper function efficiently sets multiple dependency flags as directory properties using a simple loop pattern.


117-442: LGTM: Comprehensive dependency management system.

The validation and dependency setting functions follow a consistent pattern and correctly model the inter-component dependencies. The master validation function validate_and_setup_all_clp_dependency_flags properly orchestrates the entire dependency resolution process.


445-474: LGTM: Well-implemented property-to-variable conversion.

The function efficiently converts directory properties to variables using the clean list + loop approach suggested in previous reviews. This addresses the CMake scoping issues mentioned in the PR objectives.

Comment on lines +84 to +106
if(CLP_BUILD_CLP_S_CLP_DEPENDENCIES)
add_library(
clp_s_clp_dependencies
${CLP_S_CLP_SOURCES}
)
add_library(clp_s::clp_dependencies ALIAS clp_s_clp_dependencies)
target_compile_features(clp_s_clp_dependencies PRIVATE cxx_std_20)
target_link_libraries(
clp_s_clp_dependencies
PUBLIC
clp::string_utils
ystdlib::containers
PRIVATE
Boost::regex
${CURL_LIBRARIES}
fmt::fmt
spdlog::spdlog
nlohmann_json::nlohmann_json
OpenSSL::Crypto
ystdlib::error_handling
ZStd::ZStd
)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Consider adding user feedback for disabled components.

While the conditional building works correctly, adding else() clauses with status messages would improve build transparency when components are disabled. For example:

if(CLP_BUILD_CLP_S_CLP_DEPENDENCIES)
    add_library(clp_s_clp_dependencies ${CLP_S_CLP_SOURCES})
    # ... rest of configuration
else()
    message(STATUS "Skipping clp_s_clp_dependencies (CLP_BUILD_CLP_S_CLP_DEPENDENCIES=OFF)")
endif()

Also applies to: 133-147, 169-186, 229-253, 292-315, 325-342, 353-368, 382-412

🤖 Prompt for AI Agents
In components/core/src/clp_s/CMakeLists.txt around lines 84 to 106, the
conditional blocks that build components lack else() clauses to provide user
feedback when those components are disabled. To fix this, add else() clauses
after each if() block that outputs a message(STATUS ...) indicating the
component is being skipped due to the corresponding build flag being OFF. This
improves build transparency and user awareness. Apply the same pattern to the
other specified line ranges as well.

@gibber9809 gibber9809 merged commit 04b44c5 into y-scope:main Jun 24, 2025
22 checks passed
@gibber9809 gibber9809 deleted the external-project-support branch June 24, 2025 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants