Skip to content

Commit

Permalink
feat: support the sold linker
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Aug 8, 2023
1 parent 4eb4adf commit bac4266
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Linker.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ macro(configure_linker _project_name _linker)
endif()
endmacro()

# detect custom linker
# detect a custom linker
# it prefers sold, then mold, then lld, then gold
function(detect_custom_linker LINKER)
set(SUPPORTS_LLD OFF)
set(SUPPORTS_GOLD OFF)
Expand All @@ -60,8 +61,16 @@ function(detect_custom_linker LINKER)
test_linker_option(SUPPORTS_MOLD "mold")
endif()
endif()
if(UNIX AND NOT WIN32)
find_program(PROGRAM_sold NAMES "sold")
if(EXISTS ${PROGRAM_sold})
test_linker_option(SUPPORTS_SOLD "sold")
endif()
endif()

if(SUPPORTS_MOLD)
if(SUPPORTS_SOLD)
set(${LINKER} "sold" PARENT_SCOPE)
elseif(SUPPORTS_MOLD)
set(${LINKER} "mold" PARENT_SCOPE)
elseif(SUPPORTS_LLD)
set(${LINKER} "lld" PARENT_SCOPE)
Expand Down

0 comments on commit bac4266

Please sign in to comment.