From 0c238cc5b4b08ef3dfbaf6c0a14ed99004bac226 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 17 Jun 2023 21:43:51 +0800 Subject: fix linker for cmake --- xmake/modules/package/tools/cmake.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 003bc0acd..f56467ac7 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -422,7 +422,6 @@ function _get_configs_for_mingw(package, configs, opt) envs.CMAKE_CXX_COMPILER = _translate_bin_path(package:build_getenv("cxx")) envs.CMAKE_ASM_COMPILER = _translate_bin_path(package:build_getenv("as")) envs.CMAKE_AR = _translate_bin_path(package:build_getenv("ar")) - envs.CMAKE_CUSTOM_LINKER = _translate_bin_path(package:build_getenv("ld")) envs.CMAKE_RANLIB = _translate_bin_path(package:build_getenv("ranlib")) envs.CMAKE_RC_COMPILER = _translate_bin_path(package:build_getenv("mrc")) envs.CMAKE_C_FLAGS = _get_cflags(package, opt) @@ -498,9 +497,9 @@ function _get_configs_for_cross(package, configs, opt) -- https://github.com/xmake-io/xmake-repo/pull/1039 -- https://stackoverflow.com/questions/1867745/cmake-use-a-custom-linker/25274328#25274328 -- https://github.com/xmake-io/xmake-repo/pull/2134#issuecomment-1573195810 - envs.CMAKE_CUSTOM_LINKER = _translate_bin_path(package:build_getenv("ld")) + local ld = _translate_bin_path(package:build_getenv("ld")) if package:has_tool("ld", "gxx", "clangxx") then - envs.CMAKE_CXX_LINK_EXECUTABLE = " -o " + envs.CMAKE_CXX_LINK_EXECUTABLE = ld .. " -o " end envs.CMAKE_RANLIB = _translate_bin_path(package:build_getenv("ranlib")) envs.CMAKE_C_FLAGS = _get_cflags(package, opt) @@ -563,9 +562,9 @@ function _get_configs_for_host_toolchain(package, configs, opt) -- https://github.com/xmake-io/xmake-repo/pull/1039 -- https://stackoverflow.com/questions/1867745/cmake-use-a-custom-linker/25274328#25274328 -- https://github.com/xmake-io/xmake-repo/pull/2134#issuecomment-1573195810 - envs.CMAKE_CUSTOM_LINKER = _translate_bin_path(package:build_getenv("ld")) + local ld = _translate_bin_path(package:build_getenv("ld")) if package:has_tool("ld", "gxx", "clangxx") then - envs.CMAKE_CXX_LINK_EXECUTABLE = " -o " + envs.CMAKE_CXX_LINK_EXECUTABLE = ld .. " -o " end envs.CMAKE_RANLIB = _translate_bin_path(package:build_getenv("ranlib")) envs.CMAKE_C_FLAGS = _get_cflags(package, opt) -- cgit v1.3.1