Use Threads::Threads and DL_LIBRARY for greater portability
parent
543ba3a71a
commit
d60d4cd5ee
|
@ -21,13 +21,15 @@ include(ECMPoQmTools)
|
||||||
|
|
||||||
find_package(Cargo REQUIRED)
|
find_package(Cargo REQUIRED)
|
||||||
find_package(Rust REQUIRED)
|
find_package(Rust REQUIRED)
|
||||||
|
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
# Runtime information library -- dl on Debian, execinfo on FreeBSD.
|
# Runtime information library -- dl on Debian, execinfo on FreeBSD.
|
||||||
# This quiets a warning from rustc about linking to native artifacts.
|
# This quiets a warning from rustc about linking to native artifacts.
|
||||||
if (CMAKE_SYSTEM MATCHES "FreeBSD")
|
if (CMAKE_SYSTEM MATCHES "FreeBSD")
|
||||||
find_library(DL_LIBRARY execinfo)
|
find_library(DL_LIBRARY execinfo)
|
||||||
else()
|
else()
|
||||||
find_library(DL_LIBRARY dl)
|
find_library(DL_LIBRARY ${CMAKE_DL_LIBS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# It would be neater to use set_package_properties() here and to
|
# It would be neater to use set_package_properties() here and to
|
||||||
|
|
|
@ -25,7 +25,7 @@ add_custom_command(
|
||||||
add_custom_target(rust_target DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/rust/${RUST_TARGET_DIR}/librust.a")
|
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 "${CMAKE_CURRENT_SOURCE_DIR}/rust/${RUST_TARGET_DIR}/librust.a")
|
||||||
list(APPEND DemoLibs Qt5::Widgets Qt5::Svg pthread ${DL_LIBRARY})
|
list(APPEND DemoLibs Qt5::Widgets Qt5::Svg Threads::Threads ${DL_LIBRARY})
|
||||||
if (Qt5Quick_FOUND)
|
if (Qt5Quick_FOUND)
|
||||||
list(APPEND DemoLibs Qt5::Quick)
|
list(APPEND DemoLibs Qt5::Quick)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -40,7 +40,7 @@ function(rust_test NAME DIRECTORY)
|
||||||
Qt5::Core
|
Qt5::Core
|
||||||
Qt5::Test
|
Qt5::Test
|
||||||
"${DIR}/${RUST_TARGET_DIR}/librust.a"
|
"${DIR}/${RUST_TARGET_DIR}/librust.a"
|
||||||
pthread ${DL_LIBRARY}
|
Threads::Threads ${DL_LIBRARY}
|
||||||
)
|
)
|
||||||
set_property(TARGET ${NAME}
|
set_property(TARGET ${NAME}
|
||||||
APPEND PROPERTY AUTOGEN_TARGET_DEPENDS "${SRC}/${NAME}_rust.h"
|
APPEND PROPERTY AUTOGEN_TARGET_DEPENDS "${SRC}/${NAME}_rust.h"
|
||||||
|
|
Loading…
Reference in New Issue