diff --git a/CMakeLists.txt b/CMakeLists.txt index e82ef23..f25c8d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,21 @@ include(ECMPoQmTools) find_package(Cargo REQUIRED) find_package(Rust 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") + find_library(DL_LIBRARY execinfo) +else() + find_library(DL_LIBRARY dl) +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) + message(FATAL_ERROR "No runtime information library (-ldl or -lexecinfo)") +endif() + # Find Qt modules find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index b5e5ede..966ba9a 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -25,7 +25,7 @@ add_custom_command( add_custom_target(rust_target DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/rust/${RUST_TARGET_DIR}/librust.a") list(APPEND DemoLibs "${CMAKE_CURRENT_SOURCE_DIR}/rust/${RUST_TARGET_DIR}/librust.a") -list(APPEND DemoLibs Qt5::Widgets Qt5::Svg pthread dl) +list(APPEND DemoLibs Qt5::Widgets Qt5::Svg pthread ${DL_LIBRARY}) if (Qt5Quick_FOUND) list(APPEND DemoLibs Qt5::Quick) endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c08a6da..c61a1cc 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -40,7 +40,7 @@ function(rust_test NAME DIRECTORY) Qt5::Core Qt5::Test "${DIR}/${RUST_TARGET_DIR}/librust.a" - pthread dl + pthread ${DL_LIBRARY} ) set_property(TARGET ${NAME} APPEND PROPERTY AUTOGEN_TARGET_DEPENDS "${SRC}/${NAME}_rust.h"