summaryrefslogtreecommitdiff
path: root/xmake/modules/package/tools/cmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2023-07-02 23:05:08 +0800
committerruki <[email protected]>2023-07-02 23:05:08 +0800
commit4734704b67b64b91150bfc4c22ba1d43c9c4df4d (patch)
treec991526b7d1717e735b7f76ce44a1c7e4ea5f85b /xmake/modules/package/tools/cmake.lua
parent5b203fc91970a74ec2d7c73ae04c3b666b89924f (diff)
fix tools.cmake for cross compilation #3913
Diffstat (limited to 'xmake/modules/package/tools/cmake.lua')
-rw-r--r--xmake/modules/package/tools/cmake.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 6daf89491..d9a34220a 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -489,7 +489,12 @@ function _get_configs_for_cross(package, configs, opt)
name = name:gsub("clang%-", "clang++-")
name = name:gsub("gcc$", "g++")
name = name:gsub("gcc%-", "g++-")
- envs.CMAKE_CXX_COMPILER = _translate_bin_path(dir and path.join(dir, name) or name)
+ if dir and dir ~= "." then
+ cxx = path.join(dir, name)
+ else
+ cxx = name
+ end
+ envs.CMAKE_CXX_COMPILER = _translate_bin_path(cxx)
end
-- @note The link command line is set in Modules/CMake{C,CXX,Fortran}Information.cmake and defaults to using the compiler, not CMAKE_LINKER,
-- so we need set CMAKE_CXX_LINK_EXECUTABLE to use CMAKE_LINKER as linker.