File tree Expand file tree Collapse file tree 3 files changed +42
-3
lines changed Expand file tree Collapse file tree 3 files changed +42
-3
lines changed Original file line number Diff line number Diff line change 1
- cmake_minimum_required (VERSION 2.8.12 )
1
+ cmake_minimum_required (VERSION 3.0.0 )
2
2
project (cppzmq )
3
3
4
- find_package (ZeroMQ REQUIRED )
4
+ find_package (ZeroMQ )
5
+
6
+ # libzmq autotools install: fallback to pkg-config
7
+ if (NOT ZeroMQ_FOUND )
8
+ include (${CMAKE_CURRENT_LIST_DIR} /libzmqPkgConfigFallback.cmake )
9
+ endif ()
10
+
11
+ if (NOT ZeroMQ_FOUND )
12
+ message (FATAL_ERROR "ZeroMQ was NOT found!" )
13
+ endif ()
5
14
6
15
if (ZeroMQ_FOUND AND (NOT TARGET libzmq OR NOT TARGET libzmq-static ))
7
16
message (FATAL_ERROR "ZeroMQ version not supported!" )
@@ -51,4 +60,5 @@ install(EXPORT ${PROJECT_NAME}-targets
51
60
DESTINATION ${CPPZMQ_CMAKECONFIG_INSTALL_DIR} )
52
61
install (FILES ${CMAKE_CURRENT_BINARY_DIR} /${PROJECT_NAME}Config.cmake
53
62
${CMAKE_CURRENT_BINARY_DIR} /${PROJECT_NAME}ConfigVersion.cmake
63
+ ${CMAKE_SOURCE_DIR} /libzmqPkgConfigFallback.cmake
54
64
DESTINATION ${CPPZMQ_CMAKECONFIG_INSTALL_DIR} )
Original file line number Diff line number Diff line change 17
17
@PACKAGE_INIT@
18
18
19
19
include (CMakeFindDependencyMacro )
20
- find_dependency (ZeroMQ )
20
+ find_package (ZeroMQ )
21
+
22
+ # libzmq autotools install: fallback to pkg-config
23
+ if (NOT ZeroMQ_FOUND )
24
+ include (${CMAKE_CURRENT_LIST_DIR} /libzmqPkgConfigFallback.cmake )
25
+ endif ()
26
+
27
+ if (NOT ZeroMQ_FOUND )
28
+ message (FATAL_ERROR "ZeroMQ was NOT found!" )
29
+ endif ()
21
30
22
31
if (NOT TARGET @PROJECT_NAME@ )
23
32
include (
"${CMAKE_CURRENT_LIST_DIR} /@[email protected] " )
Original file line number Diff line number Diff line change
1
+ find_package (PkgConfig )
2
+ pkg_check_modules (PC_LIBZMQ QUIET libzmq )
3
+
4
+ set (ZeroMQ_VERSION ${PC_LIBZMQ_VERSION} )
5
+ find_library (ZeroMQ_LIBRARY NAMES libzmq.so
6
+ PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS} )
7
+ find_library (ZeroMQ_STATIC_LIBRARY NAMES libzmq.a
8
+ PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS} )
9
+
10
+ add_library (libzmq SHARED IMPORTED )
11
+ set_property (TARGET libzmq PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PC_LIBZMQ_INCLUDE_DIRS} )
12
+ set_property (TARGET libzmq PROPERTY IMPORTED_LOCATION ${ZeroMQ_LIBRARY} )
13
+
14
+ add_library (libzmq-static STATIC IMPORTED ${PC_LIBZMQ_INCLUDE_DIRS} )
15
+ set_property (TARGET libzmq-static PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PC_LIBZMQ_INCLUDE_DIRS} )
16
+ set_property (TARGET libzmq-static PROPERTY IMPORTED_LOCATION ${ZeroMQ_STATIC_LIBRARY} )
17
+
18
+ if (ZeroMQ_LIBRARY AND ZeroMQ_STATIC_LIBRARY )
19
+ set (ZeroMQ_FOUND ON )
20
+ endif ()
You can’t perform that action at this time.
0 commit comments