Skip to content

Commit 7d341e6

Browse files
committed
[move FreeBSD libzstd special case to LDC_WITH_LLD linker flags block]
As according to earlier tests, it's only LLD that needs libzstd.
1 parent 361f3dc commit 7d341e6

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

CMakeLists.txt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -587,12 +587,6 @@ set_target_properties(
587587
# Use a custom .props file to set up Visual D (import paths, predefined versions...).
588588
VS_USER_PROPS "${PROJECT_SOURCE_DIR}/cmake/VisualD.props"
589589
)
590-
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
591-
# FreeBSD LLVM port links to zstd, but does not convey this information via CMake
592-
# Workaround it here until it is fixed in the port
593-
find_package(zstd)
594-
list(APPEND LLVM_LIBRARIES "$<TARGET_LINKER_FILE:zstd::libzstd_shared>")
595-
endif()
596590
# LDFLAGS should actually be in target property LINK_FLAGS, but this works, and gets around linking problems
597591
target_link_libraries(${LDC_LIB} ${LLVM_LIBRARIES} ${LLVM_LDFLAGS})
598592
if(WIN32)
@@ -626,16 +620,21 @@ if(LDC_WITH_LLD)
626620
else()
627621
set(LDC_LINKERFLAG_LIST -lLLVMSymbolize ${LDC_LINKERFLAG_LIST})
628622
endif()
629-
set(LLD_MACHO lldMachO)
630623
if(MSVC)
631-
list(APPEND LDC_LINKERFLAG_LIST lldMinGW.lib lldCOFF.lib lldELF.lib ${LLD_MACHO}.lib lldWasm.lib lldCommon.lib)
624+
list(APPEND LDC_LINKERFLAG_LIST lldMinGW.lib lldCOFF.lib lldELF.lib lldMachO.lib lldWasm.lib lldCommon.lib)
632625
else()
633-
set(LDC_LINKERFLAG_LIST -llldMinGW -llldCOFF -llldELF -l${LLD_MACHO} -llldWasm -llldCommon ${LDC_LINKERFLAG_LIST})
626+
set(LDC_LINKERFLAG_LIST -llldMinGW -llldCOFF -llldELF -llldMachO -llldWasm -llldCommon ${LDC_LINKERFLAG_LIST})
634627
endif()
635628
if(APPLE)
636629
# LLD 13.0.0 on Mac needs libxar
637630
list(APPEND LDC_LINKERFLAG_LIST -lxar)
638631
endif()
632+
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
633+
# FreeBSD LLVM port links to zstd, but does not convey this information via CMake
634+
# Workaround it here until it is fixed in the port
635+
find_package(zstd)
636+
list(APPEND LDC_LINKERFLAG_LIST "$<TARGET_LINKER_FILE:zstd::libzstd_shared>")
637+
endif()
639638
endif()
640639

641640
if(NOT DEFINED LDC_LINK_MANUALLY)

0 commit comments

Comments
 (0)