Check for -lexecinfo on FreeBSD, instead of -ldl

master
Adriaan de Groot 2017-09-03 16:09:18 +02:00
parent 830c3f99ca
commit 543ba3a71a
3 changed files with 17 additions and 2 deletions

View File

@ -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

View File

@ -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()

View File

@ -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"