mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +02:00
Internal zmq using FetchContent (#780)
* using fetchcontent to get zmq * local copy of libzmq * added guard for policy setting * removed the need to export by using build interface * removed zmq hint from cmk script --------- Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch> Co-authored-by: froejdh_e <erik.frojdh@psi.ch>
This commit is contained in:
@ -1,38 +0,0 @@
|
||||
function(custom_find_zmq)
|
||||
set(ZeroMQ_HINT "" CACHE STRING "Hint where ZeroMQ could be found")
|
||||
#Adapted from: https://github.com/zeromq/cppzmq/
|
||||
if (NOT TARGET libzmq)
|
||||
if(ZeroMQ_HINT)
|
||||
message(STATUS "Looking for ZeroMQ in: ${ZeroMQ_HINT}")
|
||||
find_package(ZeroMQ 4
|
||||
NO_DEFAULT_PATH
|
||||
HINTS ${ZeroMQ_HINT}
|
||||
)
|
||||
else()
|
||||
find_package(ZeroMQ 4 QUIET)
|
||||
endif()
|
||||
|
||||
# libzmq autotools install: fallback to pkg-config
|
||||
if(ZeroMQ_FOUND)
|
||||
message(STATUS "Found libzmq using find_package")
|
||||
else()
|
||||
message(STATUS "CMake libzmq package not found, trying again with pkg-config (normal install of zeromq)")
|
||||
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake/libzmq-pkg-config)
|
||||
find_package(ZeroMQ 4 REQUIRED)
|
||||
endif()
|
||||
|
||||
# TODO "REQUIRED" above should already cause a fatal failure if not found, but this doesn't seem to work
|
||||
if(NOT ZeroMQ_FOUND)
|
||||
message(FATAL_ERROR "ZeroMQ was not found, neither as a CMake package nor via pkg-config")
|
||||
endif()
|
||||
|
||||
if (ZeroMQ_FOUND AND NOT TARGET libzmq)
|
||||
message(FATAL_ERROR "ZeroMQ version not supported!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
get_target_property(VAR libzmq IMPORTED_LOCATION)
|
||||
message(STATUS "Using libzmq: ${VAR}")
|
||||
|
||||
|
||||
endfunction()
|
@ -1,36 +0,0 @@
|
||||
#From: https://github.com/zeromq/cppzmq/
|
||||
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PC_LIBZMQ QUIET libzmq)
|
||||
|
||||
set(ZeroMQ_VERSION ${PC_LIBZMQ_VERSION})
|
||||
|
||||
find_path(ZeroMQ_INCLUDE_DIR zmq.h
|
||||
PATHS ${ZeroMQ_DIR}/include
|
||||
${PC_LIBZMQ_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
find_library(ZeroMQ_LIBRARY
|
||||
NAMES zmq
|
||||
PATHS ${ZeroMQ_DIR}/lib
|
||||
${PC_LIBZMQ_LIBDIR}
|
||||
${PC_LIBZMQ_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
if(ZeroMQ_LIBRARY OR ZeroMQ_STATIC_LIBRARY)
|
||||
set(ZeroMQ_FOUND ON)
|
||||
message(STATUS "Found libzmq using PkgConfig")
|
||||
endif()
|
||||
|
||||
set ( ZeroMQ_LIBRARIES ${ZeroMQ_LIBRARY} )
|
||||
set ( ZeroMQ_INCLUDE_DIRS ${ZeroMQ_INCLUDE_DIR} )
|
||||
|
||||
if (NOT TARGET libzmq)
|
||||
add_library(libzmq UNKNOWN IMPORTED)
|
||||
set_target_properties(libzmq PROPERTIES
|
||||
IMPORTED_LOCATION ${ZeroMQ_LIBRARIES}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${ZeroMQ_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
include ( FindPackageHandleStandardArgs )
|
||||
find_package_handle_standard_args ( ZeroMQ DEFAULT_MSG ZeroMQ_LIBRARIES ZeroMQ_INCLUDE_DIRS )
|
@ -25,11 +25,6 @@ install(FILES
|
||||
DESTINATION ${CMAKE_INSTALL_DIR}
|
||||
)
|
||||
|
||||
install(FILES
|
||||
"${CMAKE_SOURCE_DIR}/cmake/libzmq-pkg-config/FindZeroMQ.cmake"
|
||||
COMPONENT devel
|
||||
DESTINATION ${CMAKE_INSTALL_DIR}/libzmq-pkg-config
|
||||
)
|
||||
|
||||
if (PROJECT_LIBRARIES OR PROJECT_STATIC_LIBRARIES)
|
||||
install(
|
||||
|
@ -13,17 +13,6 @@ include(CMakeFindDependencyMacro)
|
||||
set(SLS_USE_HDF5 "@SLS_USE_HDF5@")
|
||||
|
||||
|
||||
find_package(ZeroMQ 4 QUIET)
|
||||
# libzmq autotools install: fallback to pkg-config
|
||||
if(NOT ZeroMQ_FOUND)
|
||||
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/libzmq-pkg-config)
|
||||
find_package(ZeroMQ 4 REQUIRED)
|
||||
endif()
|
||||
|
||||
if(NOT ZeroMQ_FOUND)
|
||||
message(FATAL_ERROR "ZeroMQ was NOT found!")
|
||||
endif()
|
||||
|
||||
find_dependency(Threads)
|
||||
|
||||
# Add optional dependencies here
|
||||
|
Reference in New Issue
Block a user