mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
[cmake] Use lld as a first preference
Like Gold, it doesn't warn about sys_nerr, _sys_errlist, and co. Unlike Gold, we can use this on all platforms. It's also faster than both Gold and plain, old ld.
This commit is contained in:
parent
4081d58577
commit
36ed66beda
1 changed files with 14 additions and 7 deletions
|
@ -55,13 +55,20 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra \
|
||||||
# Disable exception handling.
|
# Disable exception handling.
|
||||||
add_compile_options(-fno-exceptions)
|
add_compile_options(-fno-exceptions)
|
||||||
|
|
||||||
# Prefer the gold linker because it doesn't emit useless warnings about sys_nerr and _sys_errlist.
|
# Prefer lld or the gold linker because they don't emit useless warnings about sys_nerr and
|
||||||
if (UNIX AND NOT APPLE)
|
# _sys_errlist. They're also faster (significantly so in the case of lld).
|
||||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version
|
if (UNIX)
|
||||||
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=lld -Wl,--version
|
||||||
if ("${LD_VERSION}" MATCHES "GNU gold")
|
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
|
if ("${LD_VERSION}" MATCHES "LLD ")
|
||||||
endif()
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld")
|
||||||
|
elseif (NOT APPLE)
|
||||||
|
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version
|
||||||
|
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
||||||
|
if ("${LD_VERSION}" MATCHES "GNU gold")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Hide the CMake Rules directories in Xcode projects.
|
# Hide the CMake Rules directories in Xcode projects.
|
||||||
|
|
Loading…
Reference in a new issue