Skip to content

Commit 38ca68d

Browse files
committed
Link to zstd on FreeBSD as it gets pulled in by LLVM
1 parent e14cd63 commit 38ca68d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,12 @@ 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 "-l$<TARGET_LINKER_FILE:zstd::libzstd_shared>")
595+
endif()
590596
# LDFLAGS should actually be in target property LINK_FLAGS, but this works, and gets around linking problems
591597
target_link_libraries(${LDC_LIB} ${LLVM_LIBRARIES} ${LLVM_LDFLAGS})
592598
if(WIN32)
@@ -707,7 +713,7 @@ build_d_executable(
707713
"${DFLAGS_BUILD_TYPE} ${DFLAGS_LDC}"
708714
"${ALTERNATIVE_MALLOC_O};${LDC_LINKERFLAG_LIST};${FULLY_STATIC_LDFLAG}"
709715
"${FE_RES}"
710-
"${LDC_LIB}"
716+
"${LDC_LIB};${FREEBSD_LDC_DEPS}"
711717
${COMPILE_D_MODULES_SEPARATELY}
712718
)
713719

0 commit comments

Comments
 (0)