diff options
| author | ruki <[email protected]> | 2022-03-25 00:31:06 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-03-24 21:07:09 +0800 |
| commit | b2706a335ba5476eed747bfd62e5da13dbd9f172 (patch) | |
| tree | bae51a515839ba1f40acad58e6f602407de30129 | |
| parent | 9201d0bd7ed184ae84ae9bec7a5501a81d2e58b4 (diff) | |
improve cmake tools
| -rw-r--r-- | xmake/modules/package/tools/cmake.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index d6f882446..95134319e 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -401,6 +401,17 @@ function _get_configs_for_cross(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")) + -- https://github.com/xmake-io/xmake-repo/pull/1096 + local cxx = envs.CMAKE_CXX_COMPILER + if cxx and package:has_tool("cxx", "clang", "gcc") then + local dir = path.directory(cxx) + local name = path.filename(cxx) + name = name:gsub("clang$", "clang++") + name = name:gsub("clang%-", "clang++-") + name = name:gsub("gcc$", "g++") + name = name:gsub("gcc%-", "g++-") + envs.CMAKE_CXX_COMPILER = dir and path.join(dir, name) or name + 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. -- |
