summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-09-11 23:11:42 +0800
committerruki <[email protected]>2024-09-11 23:11:42 +0800
commit921793ce047d9ae3ec4ca429f0981c05c026c397 (patch)
tree4a20eddf3223ea56447a5e88c39e2b98b0875a3f
parent25e1d8ace98008b51772abefe49c8e533c9e04b2 (diff)
improve tools.cmake for wasm
-rw-r--r--xmake/modules/package/tools/cmake.lua15
1 files changed, 9 insertions, 6 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 543d402e1..f47f69482 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -593,6 +593,7 @@ end
-- get configs for wasm
function _get_configs_for_wasm(package, configs, opt)
opt = opt or {}
+ local envs = {}
local emsdk = find_emsdk()
assert(emsdk and emsdk.emscripten, "emscripten not found!")
local emscripten_cmakefile = find_file("Emscripten.cmake", path.join(emsdk.emscripten, "cmake/Modules/Platform"))
@@ -613,12 +614,14 @@ function _get_configs_for_wasm(package, configs, opt)
end
-- avoid find and add system include/library path
- -- @see https://github.com/xmake-io/xmake/issues/2037
- -- https://github.com/xmake-io/xmake/issues/5577
- table.insert(configs, "-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH")
- table.insert(configs, "-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH")
- table.insert(configs, "-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH")
- table.insert(configs, "-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER")
+ -- @see https://github.com/xmake-io/xmake/issues/5577
+ -- https://github.com/emscripten-core/emscripten/issues/13310
+ envs.CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = "BOTH"
+ envs.CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = "BOTH"
+ envs.CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = "BOTH"
+ envs.CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "NEVER"
+ _get_configs_for_generic(package, configs, opt)
+ _insert_configs_from_envs(configs, envs, opt)
end
-- get configs for cross