1 From: Jo-Philipp Wich <jo@mein.io>
2 Date: Wed, 11 Jan 2017 03:36:04 +0100
3 Subject: [PATCH] cmcurl: link librt
5 When cmake is linked against LibreSSL, there might be an indirect
6 dependency on librt on certain systems if LibreSSL's libcrypto uses
7 clock_gettime() from librt:
9 [ 28%] Linking C executable LIBCURL
10 .../lib/libcrypto.a(getentropy_linux.o): In function `getentropy_fallback':
11 getentropy_linux.c:(.text+0x16d): undefined reference to `clock_gettime'
12 getentropy_linux.c:(.text+0x412): undefined reference to `clock_gettime'
13 collect2: error: ld returned 1 exit status
14 make[5]: *** [Utilities/cmcurl/LIBCURL] Error 1
16 Modify the cmcurl CMakeLists.txt to check for clock_gettime() in librt
17 and unconditionally link the rt library when the symbol is found.
19 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
21 --- a/Utilities/cmcurl/CMakeLists.txt
22 +++ b/Utilities/cmcurl/CMakeLists.txt
23 @@ -454,6 +454,14 @@ if(CMAKE_USE_OPENSSL)
25 set(HAVE_LIBCRYPTO ON)
27 + check_library_exists("rt" clock_gettime "" HAVE_LIBRT)
29 + list(APPEND OPENSSL_LIBRARIES rt)
31 + check_library_exists("pthread" pthread_once "" HAVE_PTHREAD)
33 + list(APPEND OPENSSL_LIBRARIES pthread)
35 list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES})
36 include_directories(${OPENSSL_INCLUDE_DIR})