From 87f72ec3de11493b5fd127c87dcbaea100d1cbaa Mon Sep 17 00:00:00 2001 From: Jack Lau Date: Fri, 10 Oct 2025 09:48:23 +0800 Subject: [PATCH] cmake: fix build error The BMF cmake_minimum_required is 3.5 but 3rd/json is 3.1 This issue can be reproduce in higher cmake version(like cmake 4.0.3): CMake Error at 3rd_party/json/CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 has been removed from CMake. Update the VERSION argument value. Or, use the ... syntax to tell CMake that the project requires at least but has been updated to work with policies introduced by or earlier. Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway. This issue could be fixed by add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 in every build script, it's so big and unmaintainable work. This patch simply add cmake policy in CMakLists.txt to be able easily removed after we update the 3rd/json cmake_minimum_required Signed-off-by: Jack Lau --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 80bda991..7b623336 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,6 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR) +# TODO: update 3rd/json cmake version minimum to remove this workaround +set(CMAKE_POLICY_VERSION_MINIMUM "3.5" CACHE STRING "Force CMake policy version to 3.5" FORCE) # Cross Compile # cmake -DCMAKE_TOOLCHAIN_FILE=cmake/aarch64-toolchain.cmake