summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/modules/package/tools/cmake.lua9
1 files 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 = "<CMAKE_CUSTOM_LINKER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>"
+ envs.CMAKE_CXX_LINK_EXECUTABLE = ld .. " <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>"
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 = "<CMAKE_CUSTOM_LINKER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>"
+ envs.CMAKE_CXX_LINK_EXECUTABLE = ld .. " <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>"
end
envs.CMAKE_RANLIB = _translate_bin_path(package:build_getenv("ranlib"))
envs.CMAKE_C_FLAGS = _get_cflags(package, opt)