Is there an existing issue?
Use case
objectbox_flutter_libs downloads libobjectbox.so at CMake configure time via
FetchContent_Populate. This makes it impossible to build in any network-isolated
environment — Flatpak/Flathub sandboxes, NixOS, Gentoo, Guix, and any distro build
system that restricts network access during the build.
The usual cmake workaround — setting FETCHCONTENT_SOURCE_DIR_OBJECTBOX-DOWNLOAD —
has no effect here. FetchContent_Populate (the pre-3.14 deprecated API) internally
spawns a cmake subbuild: a separate cmake process. Cache variables set in the
parent do not propagate to that subbuild. This is a documented cmake limitation.
Proposed solution
Check a cmake variable OBJECTBOX_PREBUILT_DIR before calling FetchContent_Populate.
If the variable points to an already-extracted archive, skip the download entirely:
if(DEFINED OBJECTBOX_PREBUILT_DIR AND EXISTS "${OBJECTBOX_PREBUILT_DIR}/lib/libobjectbox.so")
set(objectbox-download_SOURCE_DIR "${OBJECTBOX_PREBUILT_DIR}")
else()
FetchContent_GetProperties(objectbox-download)
if(NOT objectbox-download_POPULATED)
FetchContent_Populate(objectbox-download)
endif()
endif()
Distro packagers would pass:
-DOBJECTBOX_PREBUILT_DIR=/path/to/extracted/objectbox-c
Describe alternatives you've considered
Current workaround
We maintain a local patch in the Flatpak manifest for
ebalistyka-app that checks a hardcoded
relative path. It works but is fragile and app-specific.
Additional context
This patch proposes no breaking changes
Flathub has growing Flutter adoption. Every Flutter app using objectbox needs this
patch to pass Flathub CI (which runs flatpak-builder --sandbox with no network).
A one-line upstream fix lets all downstream packagers drop their local patches.
Is there an existing issue?
Use case
objectbox_flutter_libsdownloadslibobjectbox.soat CMake configure time viaFetchContent_Populate. This makes it impossible to build in any network-isolatedenvironment — Flatpak/Flathub sandboxes, NixOS, Gentoo, Guix, and any distro build
system that restricts network access during the build.
The usual cmake workaround — setting
FETCHCONTENT_SOURCE_DIR_OBJECTBOX-DOWNLOAD—has no effect here.
FetchContent_Populate(the pre-3.14 deprecated API) internallyspawns a cmake subbuild: a separate
cmakeprocess. Cache variables set in theparent do not propagate to that subbuild. This is a documented cmake limitation.
Proposed solution
Check a cmake variable
OBJECTBOX_PREBUILT_DIRbefore callingFetchContent_Populate.If the variable points to an already-extracted archive, skip the download entirely:
Distro packagers would pass:
Describe alternatives you've considered
Current workaround
We maintain a local patch in the Flatpak manifest for
ebalistyka-app that checks a hardcoded
relative path. It works but is fragile and app-specific.
Additional context
This patch proposes no breaking changes
Flathub has growing Flutter adoption. Every Flutter app using objectbox needs this
patch to pass Flathub CI (which runs
flatpak-builder --sandboxwith no network).A one-line upstream fix lets all downstream packagers drop their local patches.