summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-09-06 19:39:00 +0800
committerruki <[email protected]>2025-09-06 19:39:00 +0800
commit39d0fbd5ce88ea1a921d0d0d58419de2147b462e (patch)
tree8fd587f03769c85cccd975401873246a0199968b
parent31d2273f44022b19870f2a0f05f644ffd56bb6b5 (diff)
fix executable path for cmake #6768
-rw-r--r--xmake/plugins/project/cmake/cmakelists.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua
index 52820620a..a5ec312cb 100644
--- a/xmake/plugins/project/cmake/cmakelists.lua
+++ b/xmake/plugins/project/cmake/cmakelists.lua
@@ -32,6 +32,7 @@ import("private.utils.batchcmds")
import("private.utils.target", {alias = "target_utils"})
import("plugins.project.utils.target_cmds", {rootdir = os.programdir()})
import("rules.c++.modules.support", {alias = "module_support", rootdir = os.programdir()})
+import("private.utils.executable_path")
-- get cmake version
function _get_cmake_version()
@@ -302,7 +303,7 @@ function _set_compiler(cmakelists)
if config.get("toolchain") then
local cc = platform.tool("cc")
if cc then
- cc = path.unix(cc)
+ cc = path.unix(executable_path(cc))
cmakelists:print("set(CMAKE_C_COMPILER \"%s\")", cc)
end
local cxx, cxx_name = platform.tool("cxx")
@@ -320,7 +321,7 @@ function _set_compiler(cmakelists)
cxx = name
end
end
- cxx = path.unix(cxx)
+ cxx = path.unix(executable_path(cxx))
cmakelists:print("set(CMAKE_CXX_COMPILER \"%s\")", cxx)
end
end