File: Findcppzmq.cmake

package info (click to toggle)
tango 10.0.2%2Bdfsg1-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 89,480 kB
  • sloc: cpp: 201,245; sh: 1,645; python: 953; java: 800; perl: 467; javascript: 447; xml: 325; makefile: 269; sql: 72; ruby: 24
file content (106 lines) | stat: -rw-r--r-- 2,706 bytes parent folder | download | duplicates (8)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#[=======================================================================[.rst:
Findcppzmq
---------

Find the C++ ZeroMQ library

Imported Targets
^^^^^^^^^^^^^^^^

This module provides the following imported targets, if found:

    ``cppzmq::cppzmq``
    The C++ ZeroMQ library
    ``cppzmq::cppzmq-static``
    The C++ ZeroMQ library

Result Variables
^^^^^^^^^^^^^^^^

This will define the following variables:

    ``cppzmq_FOUND``
    True if the system has the C++ ZeroMQ library.
    ``cppzmq_static_FOUND``
    True if the system has the static C++ ZeroMQ library.
    ``cppzmq_IS_STTAIC``
    True if ``cppzmq::cppzmq-static`` is the same as ``cppzmq::cppzmq``.

Cache Variables
^^^^^^^^^^^^^^^

The following cache variables may also be set:

    ``cppzmq_INCLUDE_FILE``
    The path to ``zmq.hpp`` file.
    ``cppzmq_INCLUDE_DIR``
    The directory containing ``zmq.hpp``.

#]=======================================================================]

if (NOT DEFINED PKG_CONFIG_FOUND)
    find_package(PkgConfig QUIET)
endif()

set(_cppzmq_PKG_INCLUDE_DIRS "")  # initialise variable

# Collect hints from pkg-config
if (PKG_CONFIG_FOUND)
    pkg_search_module(_cppzmq_PKG cppzmq QUIET)
endif()

find_path(cppzmq_INCLUDE_DIR
    NAMES zmq.hpp
    PATHS "${_cppzmq_PKG_INCLUDE_DIRS}"
)

# Find the include file just so we can report it in
# find_package_handle_standard_args
find_file(cppzmq_INCLUDE_FILE
    NAMES zmq.hpp
    PATHS "" ${_cppzmq_PKG_INCLUDE_DIRS}
)

set(_cppzmq_quiet "") # initialise variable
if (cppzmq_FIND_QUIETLY)
    set(_cppzmq_quiet QUIET)
endif()

find_package(ZeroMQ ${_cppzmq_quiet})
unset(_cppzmq_required)
unset(_cppzmq_quiet)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(cppzmq
    REQUIRED_VARS
        cppzmq_INCLUDE_FILE
        cppzmq_INCLUDE_DIR
        ZeroMQ_FOUND
)

if(ZeroMQ_static_FOUND AND cppzmq_FOUND)
    set(cppzmq_static_FOUND TRUE)
    set(cppzmq_IS_STATIC ${ZeroMQ_IS_STATIC})
endif()

if (cppzmq_FOUND)
    mark_as_advanced(cppzmq_INCLUDE_FILE)
    mark_as_advanced(cppzmq_INCLUDE_DIR)
endif()

if (cppzmq_FOUND AND NOT TARGET cppzmq::cppzmq)
    add_library(cppzmq::cppzmq INTERFACE IMPORTED)
    set_target_properties(cppzmq::cppzmq PROPERTIES
        INTERFACE_INCLUDE_DIRECTORIES "${cppzmq_INCLUDE_DIR}"
        INTERFACE_LINK_LIBRARIES  ZeroMQ::ZeroMQ
    )
endif()

if(cppzmq_static_FOUND AND NOT TARGET cppzmq::cppzmq-static)
    set(cppzmq_static_FOUND TRUE)
    add_library(cppzmq::cppzmq-static INTERFACE IMPORTED)
    set_target_properties(cppzmq::cppzmq-static PROPERTIES
        INTERFACE_INCLUDE_DIRECTORIES "${cppzmq_INCLUDE_DIR}"
        INTERFACE_LINK_LIBRARIES  ZeroMQ::ZeroMQ-static
    )
endif()