2017-01-09 11:39:43 +01:00
|
|
|
# cppzmq cmake module
|
2017-04-04 12:44:52 +02:00
|
|
|
#
|
|
|
|
# The following import targets are created
|
|
|
|
#
|
|
|
|
# ::
|
|
|
|
#
|
|
|
|
# cppzmq-static
|
|
|
|
# cppzmq
|
|
|
|
#
|
2017-01-09 11:39:43 +01:00
|
|
|
# This module sets the following variables in your project::
|
|
|
|
#
|
|
|
|
# cppzmq_FOUND - true if cppzmq found on the system
|
|
|
|
# cppzmq_INCLUDE_DIR - the directory containing cppzmq headers
|
|
|
|
# cppzmq_LIBRARY - the ZeroMQ library for dynamic linking
|
|
|
|
# cppzmq_STATIC_LIBRARY - the ZeroMQ library for static linking
|
|
|
|
|
|
|
|
@PACKAGE_INIT@
|
|
|
|
|
2017-04-04 12:44:52 +02:00
|
|
|
include(CMakeFindDependencyMacro)
|
2017-07-14 16:03:06 +02:00
|
|
|
find_package(ZeroMQ)
|
|
|
|
|
|
|
|
# libzmq autotools install: fallback to pkg-config
|
|
|
|
if(NOT ZeroMQ_FOUND)
|
|
|
|
find_package(PkgConfig)
|
|
|
|
pkg_check_modules(PC_LIBZMQ QUIET libzmq)
|
|
|
|
|
|
|
|
set(ZeroMQ_VERSION ${PC_LIBZMQ_VERSION})
|
|
|
|
find_library(ZeroMQ_LIBRARY NAMES libzmq.so
|
|
|
|
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS})
|
|
|
|
find_library(ZeroMQ_STATIC_LIBRARY NAMES libzmq.a
|
|
|
|
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS})
|
|
|
|
|
|
|
|
add_library(libzmq SHARED IMPORTED)
|
|
|
|
set_property(TARGET libzmq PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PC_LIBZMQ_INCLUDE_DIRS})
|
|
|
|
set_property(TARGET libzmq PROPERTY IMPORTED_LOCATION ${ZeroMQ_LIBRARY})
|
|
|
|
|
|
|
|
add_library(libzmq-static STATIC IMPORTED ${PC_LIBZMQ_INCLUDE_DIRS})
|
|
|
|
set_property(TARGET libzmq-static PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PC_LIBZMQ_INCLUDE_DIRS})
|
|
|
|
set_property(TARGET libzmq-static PROPERTY IMPORTED_LOCATION ${ZeroMQ_STATIC_LIBRARY})
|
|
|
|
|
|
|
|
if(ZeroMQ_LIBRARY AND ZeroMQ_STATIC_LIBRARY)
|
|
|
|
set(ZeroMQ_FOUND ON)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT ZeroMQ_FOUND)
|
|
|
|
message(FATAL_ERROR "ZeroMQ was NOT found!")
|
|
|
|
endif()
|
2017-04-04 12:44:52 +02:00
|
|
|
|
|
|
|
if(NOT TARGET @PROJECT_NAME@)
|
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
|
|
|
|
|
|
|
|
get_target_property(@PROJECT_NAME@_INCLUDE_DIR cppzmq INTERFACE_INCLUDE_DIRECTORIES)
|
|
|
|
get_target_property(@PROJECT_NAME@_LIBRARY libzmq LOCATION)
|
|
|
|
get_target_property(@PROJECT_NAME@_STATIC_LIBRARY libzmq-static LOCATION)
|
|
|
|
endif()
|