support/misc/Buildroot-Initialize.cmake: make include optional

Buildroot commit [1] introduced a new Buildroot-Initialize.cmake file,
to mimic the upstream Linux-Initialize.cmake.

However, this upstream file was introduced in commit [2], which was
introduced in CMake 3.27.

When compiling a cmake package on a host with a cmake older than
version 3.27 (for example, the Buildroot Docker reference image has
cmake 3.25), the configuration fails with the error:

    CMake Error at /buildroot/output/host/share/buildroot/Platform/Buildroot-Initialize.cmake:1 (include):
      include could not find requested file:

        Platform/Linux-Initialize
    Call Stack (most recent call first):
      /usr/share/cmake-3.25/Modules/CMakeSystemSpecificInitialize.cmake:21 (include)
      CMakeLists.txt:20 (project)

CMake version < 3.27 is setting its LINUX predefine elsewhere (see
commit log of [1]), so this commit fixes the issue by simply making
the include optional. This will guarante thee cmake predefines will
be present in all the cases.

Fixes:
[1]

[1] ef9f0a07ed
[2] cc737ae829

Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Julien Olivain
2026-02-04 19:35:24 +01:00
committed by Peter Korsgaard
parent 6fed872e08
commit b69fc85e66

View File

@@ -1 +1 @@
include(Platform/Linux-Initialize)
include(Platform/Linux-Initialize OPTIONAL)