Skip to content

Commit c7766c0

Browse files
authored
Merge pull request #389 from SylvainCorlay/wrap-find-package-zeromq
Wraping calls to find_package
2 parents 5999e5a + 9cb042e commit c7766c0

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

CMakeLists.txt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,24 @@ include (DetectCPPZMQVersion)
66

77
project(cppzmq VERSION ${DETECTED_CPPZMQ_VERSION})
88

9-
find_package(ZeroMQ QUIET)
9+
if (NOT TARGET libzmq AND NOT TARGET libzmq-static)
10+
find_package(ZeroMQ QUIET)
1011

11-
# libzmq autotools install: fallback to pkg-config
12-
if(NOT ZeroMQ_FOUND)
12+
# libzmq autotools install: fallback to pkg-config
13+
if(NOT ZeroMQ_FOUND)
1314
message(STATUS "CMake libzmq package not found, trying again with pkg-config (normal install of zeromq)")
1415
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/libzmq-pkg-config)
1516
find_package(ZeroMQ REQUIRED)
16-
endif()
17+
endif()
1718

18-
# TODO "REQUIRED" above should already cause a fatal failure if not found, but this doesn't seem to work
19-
if(NOT ZeroMQ_FOUND)
19+
# TODO "REQUIRED" above should already cause a fatal failure if not found, but this doesn't seem to work
20+
if(NOT ZeroMQ_FOUND)
2021
message(FATAL_ERROR "ZeroMQ was not found, neither as a CMake package nor via pkg-config")
21-
endif()
22+
endif()
2223

23-
if (ZeroMQ_FOUND AND (NOT TARGET libzmq OR NOT TARGET libzmq-static))
24-
message(FATAL_ERROR "ZeroMQ version not supported!")
24+
if (ZeroMQ_FOUND AND (NOT TARGET libzmq OR NOT TARGET libzmq-static))
25+
message(FATAL_ERROR "ZeroMQ version not supported!")
26+
endif()
2527
endif()
2628

2729
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")

0 commit comments

Comments
 (0)