From 1b850288280f5d84a0c8bbf6b13a6e9c07855073 Mon Sep 17 00:00:00 2001 From: star9029 <hengxings783@gmail.com> Date: Tue, 5 Nov 2024 17:51:45 +0800 Subject: [PATCH] boost: move old version check to on_load (#5667) --- packages/b/boost/xmake.lua | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/b/boost/xmake.lua b/packages/b/boost/xmake.lua index 5fc6f0306..cd9053c80 100644 --- a/packages/b/boost/xmake.lua +++ b/packages/b/boost/xmake.lua @@ -44,7 +44,7 @@ package("boost") add_configs("zstd", {description = "Enable zstd for iostreams", default = false, type = "boolean"}) add_configs("openssl", {description = "Enable openssl for mysql/redis", default = false, type = "boolean"}) - add_configs("cmake", {description = "Use cmake build system", default = true, type = "boolean"}) + add_configs("cmake", {description = "Use cmake build system (>= 1.86)", default = true, type = "boolean"}) add_configs("all", {description = "Enable all library modules support.", default = false, type = "boolean"}) add_configs("header_only", {description = "Enable header only modules", default = false, type = "boolean"}) @@ -70,17 +70,17 @@ package("boost") raise("package(boost/b2) unsupported current platform.") end end - - local version = package:version() - if package:config("cmake") and version:lt("1.86") then - raise("package(boost/cmake) only support >= 1.86.0 version") - end end) end on_load(function (package) local version = package:version() - if package:config("cmake") and version:ge("1.86") then + if package:config("cmake") and version:lt("1.86") then + -- Don't break old version + package:config_set("cmake", false) + end + + if package:config("cmake") then wprint("If cmake build failure, set package config cmake = false fallback to b2 for the build") package:add("deps", "cmake") @@ -94,8 +94,7 @@ package("boost") end) on_install(function (package) - local version = package:version() - if package:config("cmake") and version:ge("1.86") then + if package:config("cmake") then assert(os.isfile("CMakeLists.txt"), "Currently the source archive only has the b2 build system, you need to download the cmake archive and put it in `xmake g --pkg_searchdirs=` to avoid xrepo using a non-cmake archive url.") import("cmake.install")(package) else