From 6b1199d8013f0ff158e481f7726737d26e965cd2 Mon Sep 17 00:00:00 2001 From: Willem Jan Withagen Date: Wed, 23 Oct 2019 14:12:25 +0200 Subject: [PATCH] cmake: use GNU linker on FreeBSD The LLVM ld linker does not understand the versioning mapping. This is a "documented" difference between GNU ld en LLVM ld. So we fall back to the GNU linker in the binutils package. Fixing this with a option to cmake is not possible when building FreeBSD packages. Many of these options are filtered in the ports make system. And do not make it to cmake being called to build the build-tree. Signed-off-by: Willem Jan Withagen --- src/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3b1295cd0c2..a6c673c4094 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -67,6 +67,11 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL Clang) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-varargs") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-gnu-designator") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-braces -Wno-parentheses -Wno-deprecated-register") + if(FREEBSD) + # Need to use the GNU binutils linker to get versioning right. + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=/usr/local/bin/ld -Wno-unused-command-line-argument") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=/usr/local/bin/ld -Wno-unused-command-line-argument") + endif() if(APPLE) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup") endif() -- 2.39.5