]> git.uio.no Git - u/mrichter/AliRoot.git/blob - cmake/FindZeroMQ.cmake
Do not include from subdirectories
[u/mrichter/AliRoot.git] / cmake / FindZeroMQ.cmake
1 # **************************************************************************
2 # * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
3 # *                                                                        *
4 # * Author: The ALICE Off-line Project.                                    *
5 # * Contributors are mentioned in the code where appropriate.              *
6 # *                                                                        *
7 # * Permission to use, copy, modify and distribute this software and its   *
8 # * documentation strictly for non-commercial purposes is hereby granted   *
9 # * without fee, provided that the above copyright notice appears in all   *
10 # * copies and that both the copyright notice and this permission notice   *
11 # * appear in the supporting documentation. The authors make no claims     *
12 # * about the suitability of this software for any purpose. It is          *
13 # * provided "as is" without express or implied warranty.                  *
14 # **************************************************************************
15
16 # Checks for a ZeroMQ installation
17 # ZeroMQ custom installation can be pointed using -DZEROMQ
18 #       - ZEROMQ_INCLUDE_DIR - Where to find zeromq include sub-directory.
19 #       - ZEROMQ_LIBRARIES   - List of libraries when using zeromq.
20 #       - ZEROMQ_FOUND       - True if zeromq found.
21
22 message(STATUS "Checking for ZeroMQ ${ZEROMQ}")
23
24 set(ZEROMQ_FOUND FALSE)
25
26 if(ZEROMQ)
27     # ZeroMQ is installed in a custom place
28     find_library(ZEROMQ_LIBRARIES NAMES zmq
29                 PATHS ${ZEROMQ}/lib
30                 NO_DEFAULT_PATH
31                 DOC "Path to libzmq)"
32             )
33
34     find_path(ZEROMQ_INCLUDE_DIR NAMES zmq.h zmq_utils.h zmq.hpp}
35                 PATHS ${ZEROMQ}/include
36                 NO_DEFAULT_PATH
37                 DOC "Path to ZeroMQ include header files."
38             )       
39 else(ZEROMQ)
40     # Check is the library is installed on the system
41     find_library(ZEROMQ_LIBRARIES NAMES zmq
42                 DOC "Path to libzmq)"
43             )
44
45     find_path(ZEROMQ_INCLUDE_DIR NAMES zmq.hpp zmq_utils.h}
46                 DOC "Path to ZeroMQ include header files."
47             )
48 endif(ZEROMQ)
49
50 set(ZEROMQ_DISABLED FALSE)
51
52 if(NOT ZEROMQ_LIBRARIES)
53     message(STATUS "ZeroMQ library not found. Disabling ZeroMQ support")
54     set(ZEROMQ_DISABLED TRUE)
55 endif()
56
57 if(NOT ZEROMQ_INCLUDE_DIR AND NOT ZEROMQ_DISABLED)
58     message(STATUS "ZeroMQ headers not found. Please install development package + cppzmq interface. Disabling ZeroMQ support")
59     set(ZEROMQ_DISABLED TRUE)
60 endif()
61
62 if(ZEROMQ_LIBRARIES AND ZEROMQ_INCLUDE_DIR)
63     message(STATUS "Found ZeroMQ ${ZEROMQ_LIBRARIES}")
64     set(ZEROMQ_FOUND TRUE)
65 endif()
66
67 if(ZEROMQ_FOUND)
68     add_definitions(-DZMQ)
69 ENDIF(ZEROMQ_FOUND)
70
71