summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-04-10 22:42:03 +0800
committerruki <[email protected]>2025-04-10 22:42:03 +0800
commitfa122559e2fcb560f7be7b6f61241b8caf524c65 (patch)
tree363543b5963be41a5f44dc7ba974050cfff17555
parent1268cad62854df59e71757a55fddd74ebde6c65f (diff)
improve cmake:find_package again #6296
-rw-r--r--xmake/modules/package/manager/cmake/find_package.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/xmake/modules/package/manager/cmake/find_package.lua b/xmake/modules/package/manager/cmake/find_package.lua
index 4b1c390f0..4c71291d7 100644
--- a/xmake/modules/package/manager/cmake/find_package.lua
+++ b/xmake/modules/package/manager/cmake/find_package.lua
@@ -81,10 +81,16 @@ function _find_package(cmake, name, opt)
if moduledirs then
for _, moduledir in ipairs(moduledirs) do
cmakefile:print("list(APPEND CMAKE_MODULE_PATH \"%s\")", (moduledir:gsub("\\", "/")))
- -- https://github.com/xmake-io/xmake/issues/6296
- cmakefile:print("list(APPEND CMAKE_PREFIX_PATH \"%s\")", (moduledir:gsub("\\", "/")))
end
end
+ -- https://github.com/xmake-io/xmake/issues/6296
+ local prefixdirs = configs.prefixdirs or opt.prefixdirs
+ if prefixdirs then
+ for _, prefixdir in ipairs(prefixdirs) do
+ cmakefile:print("list(APPEND CMAKE_PREFIX_PATH \"%s\")", (prefixdir:gsub("\\", "/")))
+ end
+ end
+
-- e.g. set(Boost_USE_STATIC_LIB ON)
local presets = configs.presets or opt.presets
if presets then