From 59d0092e55dae9c1965da30c6bb6890e46e43a77 Mon Sep 17 00:00:00 2001 From: Jos van den Oever Date: Tue, 9 Oct 2018 00:05:29 +0200 Subject: [PATCH] Build even when CMAKE_DL_LIBS is not defined --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d78407..74d7cd6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,15 +32,17 @@ find_package(Threads REQUIRED) # Runtime information library -- dl on Debian, execinfo on FreeBSD. # This quiets a warning from rustc about linking to native artifacts. if (CMAKE_SYSTEM MATCHES "FreeBSD") + set(NEED_DL_LIBRARY true) find_library(DL_LIBRARY execinfo) -else() +elseif (DEFINED CMAKE_DL_LIBS) + set(NEED_DL_LIBRARY true) find_library(DL_LIBRARY ${CMAKE_DL_LIBS}) endif() # It would be neater to use set_package_properties() here and to # rely on feature_summary(), below, but that entails using find_package() # and moving this whole thing into a Find-module, which is over-wrought. -if (NOT DL_LIBRARY) +if (NEED_DL_LIBRARY AND NOT DL_LIBRARY) message(FATAL_ERROR "No runtime information library (-ldl or -lexecinfo)") endif()