From 71e08e513346547d78b25d3b0b77c00f15ab469b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6=20Fahlke?= <jorrit@jorrit.de> Date: Tue, 12 May 2015 19:33:31 +0200 Subject: [PATCH] [release][fs1650][cmake] Add -Wl,-no-as-needed to the linker flags if we are on Ubuntu. --- cmake/modules/CheckCXX11Features.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmake/modules/CheckCXX11Features.cmake b/cmake/modules/CheckCXX11Features.cmake index 3f6b8e2e3..5a3a7b852 100644 --- a/cmake/modules/CheckCXX11Features.cmake +++ b/cmake/modules/CheckCXX11Features.cmake @@ -278,8 +278,16 @@ if(${CMAKE_VERSION} VERSION_LESS "3.1") else() find_package(Threads) endif() -set(STDTHREAD_LINK_FLAGS "${CMAKE_THREAD_LIBS_INIT}" - CACHE STRING "Linker flags needed to get working C++11 threads support") + +# see whether threading needs -no-as-needed +if(EXISTS /etc/dpkg/origins/ubuntu) + set(NO_AS_NEEDED "-Wl,-no-as-needed") +else(EXISTS /etc/dpkg/origins/ubuntu) + set(NO_AS_NEEDED "") +endif(EXISTS /etc/dpkg/origins/ubuntu) + +set(STDTHREAD_LINK_FLAGS "${NO_AS_NEEDED} ${CMAKE_THREAD_LIBS_INIT}" + CACHE STRING "Linker flags needed to get working C++11 threads support. On Ubuntu it may be necessary to include -Wl,-no-as-needed (see FS#1650).") # set linker flags # -- GitLab