Skip to content

Commit 125c24a

Browse files
committed
Fix cmake find_package on wasm
1 parent 79e2824 commit 125c24a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

xmake/modules/package/tools/cmake.lua

+11
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,18 @@ function _get_configs_for_wasm(package, configs, opt)
610610
end
611611
end
612612
end
613+
614+
local envs = {}
615+
local deps_installdir = {}
616+
for _, dep in ipairs(package:librarydeps({private = true})) do
617+
if not dep:is_system() then
618+
table.insert(deps_installdir, dep:installdir())
619+
end
620+
end
621+
-- https://github.com/emscripten-core/emscripten/issues/13310
622+
envs.CMAKE_FIND_ROOT_PATH = path.joinenv(deps_installdir)
613623
_get_configs_for_generic(package, configs, opt)
624+
_insert_configs_from_envs(configs, envs, opt)
614625
end
615626

616627
-- get configs for cross

0 commit comments

Comments
 (0)