Skip to content

Replace git submodules with find_package + FetchContent - #4085

Open
paulromano wants to merge 3 commits into
openmc-dev:developfrom
paulromano:replace-git-submodules
Open

Replace git submodules with find_package + FetchContent#4085
paulromano wants to merge 3 commits into
openmc-dev:developfrom
paulromano:replace-git-submodules

Conversation

@paulromano

Copy link
Copy Markdown
Contributor

Description

This PR replaces the use of git submodules (fmt, pugixml, Catch2) with a find_package + FetchContent approach. For each of the dependencies, find_package is called first and if it finds a suitable package will use it directly. If none is found, it falls back to CMake FetchContent archives pinned to release tags. This allows ordinary source clones and archives to configure without git-managed dependencies. I've also updated Catch2 to the latest v3.16.0 release because the previous submodule revision was untagged.

In order to keep the dependency workflow compatible with our stated policy, I've raised the declared CMake minimum version to CMake 3.22 and implemented an explicit workflow that calls find_package followed by FetchContent if needed. CMake version 3.24 introduces better integration so once our minimum is >= 3.24, we can simplify the setup.

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 18) on any C++ source files (if applicable)
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

paulromanoand others added 2 commits August 29, 2026 17:48
Pin fmt, pugixml, and Catch2 to release tags rather than bare commit
SHAs. The fmt and pugixml pins resolve to the same source the submodules
pointed at (11.0.2 and v1.15). The Catch2 submodule pointed at an
untagged commit from May 2023 (v3.3.2-46-g5a40b227), so there was no
lossless tag to move to and it is pinned to v3.16.0 instead.
Warn about the removed OPENMC_FORCE_VENDORED_LIBS and GIT_SUBMODULE
options rather than silently ignoring them.
In the new CI job, check out full history and tags so that git describe
based versioning works instead of falling back to 0.0.0, build the C++
unit tests so that the Catch2 code path is covered, run ctest, and add a
matrix leg that resolves fmt and pugixml as installed packages.
Document FETCHCONTENT_FULLY_DISCONNECTED and FETCHCONTENT_BASE_DIR for
packaging, and drop the legacy target alias after
FetchContent_MakeAvailable, which is unreachable because pugixml defines
that alias itself.
Revert the release notes for 0.16.0, which has already been released.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for freeto 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.

1 participant

@paulromano