Skip to content

Commit

Permalink
Fix LDC compilation with LDC 1.37 universal on macOS. Make ExtractDMD…
Browse files Browse the repository at this point in the history
…SystemLinker.cmake compatible with `-target` and `-arch` (ldc-developers#4431)

The attempt to use CMake's `target_link_options` for `D_LINKER_ARGS` failed, because the list can be a mix of library dependencies and options.

LDC upstream: 0b62d9d
  • Loading branch information
JohanEngelen committed Jul 24, 2024
1 parent 2d47922 commit 431eebb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmake/Modules/ExtractDMDSystemLinker.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ separate_arguments(linker_line)
list(GET linker_line 0 D_LINKER_COMMAND)
list(REMOVE_AT linker_line 0)

# Fixup known flags with spaces, such as "-target triple" argument, which would be turned
# into "-target;triple" by `separate_arguments`. Repair by merging into one list item.
string(REGEX REPLACE ";-target;([A-Za-z0-9_-]+)(;?)" ";-target \\1\\2" linker_line "${linker_line}")
string(REGEX REPLACE ";-arch;([A-Za-z0-9_-]+)(;?)" ";-arch \\1\\2" linker_line "${linker_line}")

if("${D_COMPILER_ID}" STREQUAL "GDMD")
# Filter linker arguments for those we know can be safely reused
set(D_LINKER_ARGS)
Expand Down

0 comments on commit 431eebb

Please sign in to comment.