From 5045cb0b591c9bcd50cd09d040d56dbd8fbeee70 Mon Sep 17 00:00:00 2001 From: MeanSquaredError <35379301+MeanSquaredError@users.noreply.github.com> Date: Thu, 20 Nov 2025 17:16:42 +0200 Subject: cmake find_package: Add configuration option allow_empty_package that allows system packages that don't need any include directories or linked libraries. --- xmake/modules/package/manager/cmake/configurations.lua | 1 + xmake/modules/package/manager/cmake/find_package.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/xmake/modules/package/manager/cmake/configurations.lua b/xmake/modules/package/manager/cmake/configurations.lua index e0a9f7d9a..9945ca191 100644 --- a/xmake/modules/package/manager/cmake/configurations.lua +++ b/xmake/modules/package/manager/cmake/configurations.lua @@ -29,6 +29,7 @@ function main() moduledirs = {description = "Set the cmake modules directories."}, presets = {description = "Set the preset values, e.g. {Boost_USE_STATIC_LIB = true}"}, envs = {description = "Set the run environments of cmake, e.g. {CMAKE_PREFIX_PATH = \"xxx\"}"}, + allow_empty_package = {description = "Accept package even if it doesn't have any include directories or linked libraries"}, } end diff --git a/xmake/modules/package/manager/cmake/find_package.lua b/xmake/modules/package/manager/cmake/find_package.lua index f1b4cd321..376b583dd 100644 --- a/xmake/modules/package/manager/cmake/find_package.lua +++ b/xmake/modules/package/manager/cmake/find_package.lua @@ -301,7 +301,7 @@ function _find_package(cmake, name, opt) os.tryrm(workdir) -- get results - if links or includedirs then + if configs.allow_empty_package or links or includedirs then local results = {} results.links = table.reverse_unique(links) results.ldflags = table.reverse_unique(ldflags) -- cgit v1.3.1