Skip to content

CMakeLists.txt: Allow disabling FetchContent#235

Merged
pierotofy merged 2 commits into
pierotofy:mainfrom
roxwize:fixfetch
May 31, 2026
Merged

CMakeLists.txt: Allow disabling FetchContent#235
pierotofy merged 2 commits into
pierotofy:mainfrom
roxwize:fixfetch

Conversation

@roxwize

@roxwize roxwize commented May 31, 2026

Copy link
Copy Markdown
Contributor

The CMake configuration script fetches four dependencies from the Internet by default. This results in errors on my end in the form of protocol "https" not supported.

This patchset simply gates the calls to FetchContent that perform this fetching behind the flags FETCH_NLOHMANN_JSON, FETCH_NANOFLANN, etc. If a dependency's respective FETCH flag is disabled, a traditional call to find_package is used instead. For compatibility and consistency reasons, these flags are enabled by default.

Besides fixing the issue stated previously, this patchset also makes configuration faster for people who already have these dependencies downloaded beforehand. In my case, I have a shell.nix that contains lists of the dependencies to be downloaded verbatim that I can then set up a shell environment from, and since I have all of these dependencies, fetching them is unnecessary. I have attempted configuring and building on this patchset with all of the FETCH_* flags set to off, and OpenSplat is able to compile without any issue.

Signed-off-by: roxwize <rae@roxwize.xyz>
@pierotofy

Copy link
Copy Markdown
Owner

Your CMake binary must be compiled without SSL/curl support?

I'm OK adding a flag to disable FetchContent, can you please consolidate into a single flag rather than 4? 🙏

@roxwize

roxwize commented May 31, 2026

Copy link
Copy Markdown
Contributor Author

Yes, I'll do that.

Your CMake binary must be compiled without SSL/curl support?

NixOS, and ergo the version of CMake provided with Nixpkgs, seems to have SSL support disabled. I tried to work around this but ended up just deciding to patch the CMake script to get the dependencies directly instead. https://discourse.nixos.org/t/dealing-with-cmake-fetchcontent/34768

COLMAP uses FetchContent like this as well, but it puts them behind a default-on flag similarly to what I'm doing here.

Signed-off-by: roxwize <rae@roxwize.xyz>
@pierotofy

Copy link
Copy Markdown
Owner

Looks good to me, thanks @roxwize

@pierotofy
pierotofy merged commit 9fb62fd into pierotofy:main May 31, 2026
18 of 28 checks passed
@roxwize
roxwize deleted the fixfetch branch May 31, 2026 17:43
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