Skip to content

Commit

Permalink
Wrap find_package
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainCorlay committed Mar 5, 2020
1 parent 5999e5a commit 8d731ea
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,24 @@ include (DetectCPPZMQVersion)

project(cppzmq VERSION ${DETECTED_CPPZMQ_VERSION})

find_package(ZeroMQ QUIET)
if (NOT TARGET libzmq)
find_package(ZeroMQ QUIET)

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

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

if (ZeroMQ_FOUND AND (NOT TARGET libzmq OR NOT TARGET libzmq-static))
message(FATAL_ERROR "ZeroMQ version not supported!")
if (ZeroMQ_FOUND AND (NOT TARGET libzmq OR NOT TARGET libzmq-static))
message(FATAL_ERROR "ZeroMQ version not supported!")
endif()
endif()

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

0 comments on commit 8d731ea

Please sign in to comment.