This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
FindZeroMQ.cmake
56 lines (47 loc) · 2.2 KB
/
FindZeroMQ.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
if(CONAN_INCLUDE_DIRS_ZMQ AND CONAN_LIB_DIRS_ZMQ AND CONAN_LIBS_ZMQ)
find_path(ZeroMQ_INCLUDE_DIR NAMES zmq.h PATHS ${CONAN_INCLUDE_DIRS_ZMQ} NO_CMAKE_FIND_ROOT_PATH)
find_library(ZeroMQ_LIBRARY NAMES ${CONAN_LIBS_ZMQ} PATHS ${CONAN_LIB_DIRS_ZMQ} NO_CMAKE_FIND_ROOT_PATH)
else()
find_path(ZeroMQ_INCLUDE_DIR NAMES zmq.h)
find_library(ZeroMQ_LIBRARY NAMES zmq)
endif()
MESSAGE("** ZeroMQ ALREADY FOUND BY CONAN!")
SET(ZeroMQ_FOUND TRUE)
MESSAGE("** FOUND ZeroMQ: ${ZeroMQ_LIBRARY}")
MESSAGE("** FOUND ZeroMQ INCLUDE: ${ZeroMQ_INCLUDE_DIR}")
set(ZeroMQ_INCLUDE_DIRS ${ZeroMQ_INCLUDE_DIR})
set(ZeroMQ_LIBRARIES ${ZeroMQ_LIBRARY})
if(MSVC)
set(ZeroMQ_LIBRARIES "${ZeroMQ_LIBRARIES};ws2_32;iphlpapi")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "QNX")
set(ZeroMQ_LIBRARIES "${ZeroMQ_LIBRARIES};socket;m")
elseif(UNIX AND NOT APPLE)
set(ZeroMQ_LIBRARIES "${ZeroMQ_LIBRARIES};pthread;rt;m")
endif()
if (DEFINED CONAN_LIBSODIUM_ROOT)
if(CONAN_INCLUDE_DIRS_ZMQ AND CONAN_LIB_DIRS_ZMQ AND CONAN_LIBS_ZMQ)
find_library(SODIUM_LIBRARY NAMES ${CONAN_LIBS_LIBSODIUM} PATHS ${CONAN_LIB_DIRS_LIBSODIUM} NO_CMAKE_FIND_ROOT_PATH)
else()
find_library(SODIUM_LIBRARY NAMES sodium)
endif()
set(ZeroMQ_LIBRARIES "${ZeroMQ_LIBRARIES};${SODIUM_LIBRARY}")
endif()
if(DEFINED CONAN_LIBCXX)
if(CONAN_LIBCXX STREQUAL "libstdc++" OR CONAN_LIBCXX STREQUAL "libstdc++11")
set(ZeroMQ_LIBRARIES "${ZeroMQ_LIBRARIES};stdc++")
elseif(CONAN_LIBCXX STREQUAL "libc++")
set(ZeroMQ_LIBRARIES "${ZeroMQ_LIBRARIES};c++")
endif()
endif()
mark_as_advanced(ZeroMQ_LIBRARY ZeroMQ_INCLUDE_DIR)
set(ZeroMQ_MAJOR_VERSION "4")
set(ZeroMQ_MINOR_VERSION "2")
set(ZeroMQ_PATCH_VERSION "2")
set(ZeroMQ_VER "${ZeroMQ_MAJOR_VERSION}.${ZeroMQ_MINOR_VERSION}.${ZeroMQ_PATCH_VERSION}")
set(ZeroMQ_VERSION ${ZeroMQ_VER})
add_library(libzmq INTERFACE IMPORTED)
set_property(TARGET libzmq PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${ZeroMQ_INCLUDE_DIRS})
set_property(TARGET libzmq PROPERTY INTERFACE_LINK_LIBRARIES ${ZeroMQ_LIBRARIES})
add_library(libzmq-static INTERFACE IMPORTED)
set_property(TARGET libzmq-static PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${ZeroMQ_INCLUDE_DIRS})
set_property(TARGET libzmq-static PROPERTY INTERFACE_LINK_LIBRARIES ${ZeroMQ_LIBRARIES})