Skip to content

Use system GTest if available#405

Merged
superg merged 1 commit into
superg:mainfrom
ypsvlq:gtest
Jul 5, 2026
Merged

Use system GTest if available#405
superg merged 1 commit into
superg:mainfrom
ypsvlq:gtest

Conversation

@ypsvlq

@ypsvlq ypsvlq commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

For build environments without internet access (common for Linux distributions).

Summary by CodeRabbit

  • Chores
    • Updated the project’s test dependency configuration to better detect GoogleTest during setup.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This change adds a single FIND_PACKAGE_ARGS NAMES GTest option to the FetchContent_Declare call for googletest in tests/CMakeLists.txt, allowing CMake to use an existing installed GTest package instead of always fetching it.

Changes

CMake test dependency configuration

Layer / File(s) Summary
FetchContent GTest package args
tests/CMakeLists.txt
Adds FIND_PACKAGE_ARGS NAMES GTest to the googletest FetchContent_Declare block.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Estimated code review effort

1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the change to prefer a system-installed GTest when available.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tests/CMakeLists.txt (1)

7-7: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

No version constraint on the found system GTest.

FIND_PACKAGE_ARGS NAMES GTest accepts any installed GTest version, while the fetch fallback pins v1.15.2. This can let CI/dev machines silently use an older/newer system GTest than the tested baseline, causing hard-to-reproduce differences between environments. Consider pinning a minimum version, e.g. FIND_PACKAGE_ARGS 1.15 NAMES GTest.

♻️ Proposed fix
-    FIND_PACKAGE_ARGS NAMES GTest
+    FIND_PACKAGE_ARGS 1.15 NAMES GTest
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/CMakeLists.txt` at line 7, The system GTest lookup in the test
dependency setup is unpinned, so it can resolve to any installed version instead
of matching the fetched baseline. Update the test CMake package discovery around
the `FIND_PACKAGE_ARGS` / `GTest` configuration to require a minimum version
consistent with the fallback fetch (for example, a 1.15.x floor), so
`find_package` and the fallback path stay aligned across environments.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/CMakeLists.txt`:
- Line 7: The system GTest lookup in the test dependency setup is unpinned, so
it can resolve to any installed version instead of matching the fetched
baseline. Update the test CMake package discovery around the `FIND_PACKAGE_ARGS`
/ `GTest` configuration to require a minimum version consistent with the
fallback fetch (for example, a 1.15.x floor), so `find_package` and the fallback
path stay aligned across environments.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ba9c541f-857c-4662-996b-183e3aafeecc

📥 Commits

Reviewing files that changed from the base of the PR and between cbf7c9b and 8411b26.

📒 Files selected for processing (1)
  • tests/CMakeLists.txt

@ypsvlq

ypsvlq commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

This can let CI/dev machines silently use an older/newer system GTest than the tested baseline, causing hard-to-reproduce differences between environments. Consider pinning a minimum version, e.g. FIND_PACKAGE_ARGS 1.15 NAMES GTest.

Unless the minimum version has actually been determined, I don't think this is a good change.

@superg superg merged commit a1dc944 into superg:main Jul 5, 2026
11 checks passed
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.

2 participants