1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 03:17:34 +00:00

Meta: Link Lagom with LLD by default and allow configuring the linker

This ports over the `LADYBIRD_USE_LLD` option from the standalone
Ladybird build and generalizes it to work for mold as well: the
`LAGOM_USE_LINKER` variable can be set to the desired name of the
linker. If it's empty, we default to trying LLD and Mold on ELF
platforms (in this order).
This commit is contained in:
Daniel Bertalan 2023-09-05 07:40:57 +02:00 committed by Andreas Kling
parent 07039af982
commit dac443fbff
6 changed files with 46 additions and 23 deletions

View file

@ -19,6 +19,11 @@ endif()
# https://cmake.org/cmake/help/latest/policy/CMP0058.html
cmake_policy(SET CMP0058 NEW)
# Make CMAKE_EXE_LINKER_FLAGS have an effect on `try_compile()` jobs.
# This is required if we want to have the `LAGOM_USE_LINKER` option
# take effect in `check_linker_flag` checks.
cmake_policy(SET CMP0056 NEW)
get_filename_component(
SERENITY_PROJECT_ROOT "${PROJECT_SOURCE_DIR}/../.."
ABSOLUTE CACHE
@ -34,6 +39,7 @@ if(NOT COMMAND serenity_option)
endif()
include(check_for_dependencies)
include(use_linker)
include(lagom_options NO_POLICY_SCOPE)
if(ENABLE_ALL_THE_DEBUG_MACROS)
@ -106,10 +112,6 @@ if (ENABLE_COMPILETIME_FORMAT_CHECK)
add_compile_definitions(ENABLE_COMPILETIME_FORMAT_CHECK)
endif()
if (ENABLE_LAGOM_MOLD)
add_link_options(-fuse-ld=mold)
endif()
if (ENABLE_FUZZERS)
add_compile_options(-fno-omit-frame-pointer)
endif()