if(CONAN_INCLUDE_DIRS_ZMQ AND CONAN_LIB_DIRS_ZMQ AND CONAN_LIBS_ZMQ)
	find_path(ZeroMQ_INCLUDE_DIR NAMES zmq.h PATHS ${CONAN_INCLUDE_DIRS_ZMQ} NO_CMAKE_FIND_ROOT_PATH)
	find_library(ZeroMQ_LIBRARY NAMES ${CONAN_LIBS_ZMQ} PATHS ${CONAN_LIB_DIRS_ZMQ} NO_CMAKE_FIND_ROOT_PATH)
else()
	find_path(ZeroMQ_INCLUDE_DIR NAMES zmq.h)
	find_library(ZeroMQ_LIBRARY NAMES zmq)
endif()

MESSAGE("** ZeroMQ ALREADY FOUND BY CONAN!")
SET(ZeroMQ_FOUND TRUE)
MESSAGE("** FOUND ZeroMQ:  ${ZeroMQ_LIBRARY}")
MESSAGE("** FOUND ZeroMQ INCLUDE:  ${ZeroMQ_INCLUDE_DIR}")

set(ZeroMQ_INCLUDE_DIRS ${ZeroMQ_INCLUDE_DIR})
set(ZeroMQ_LIBRARIES ${ZeroMQ_LIBRARY})

if(MSVC)
  set(ZeroMQ_LIBRARIES "${ZeroMQ_LIBRARIES};ws2_32;iphlpapi")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "QNX")
	set(ZeroMQ_LIBRARIES "${ZeroMQ_LIBRARIES};socket;m")
elseif(UNIX AND NOT APPLE)
  set(ZeroMQ_LIBRARIES "${ZeroMQ_LIBRARIES};pthread;rt;m")
endif()

if (DEFINED CONAN_LIBSODIUM_ROOT)
	if(CONAN_INCLUDE_DIRS_ZMQ AND CONAN_LIB_DIRS_ZMQ AND CONAN_LIBS_ZMQ)
		find_library(SODIUM_LIBRARY NAMES ${CONAN_LIBS_LIBSODIUM} PATHS ${CONAN_LIB_DIRS_LIBSODIUM} NO_CMAKE_FIND_ROOT_PATH)
	else()
		find_library(SODIUM_LIBRARY NAMES sodium)
	endif()
    set(ZeroMQ_LIBRARIES "${ZeroMQ_LIBRARIES};${SODIUM_LIBRARY}")
endif()

if(DEFINED CONAN_LIBCXX)
    if(CONAN_LIBCXX STREQUAL "libstdc++" OR CONAN_LIBCXX STREQUAL "libstdc++11")
      set(ZeroMQ_LIBRARIES "${ZeroMQ_LIBRARIES};stdc++")
    elseif(CONAN_LIBCXX STREQUAL "libc++")
      set(ZeroMQ_LIBRARIES "${ZeroMQ_LIBRARIES};c++")
    endif()
endif()

mark_as_advanced(ZeroMQ_LIBRARY ZeroMQ_INCLUDE_DIR)

set(ZeroMQ_MAJOR_VERSION "4")
set(ZeroMQ_MINOR_VERSION "2")
set(ZeroMQ_PATCH_VERSION "2")
set(ZeroMQ_VER "${ZeroMQ_MAJOR_VERSION}.${ZeroMQ_MINOR_VERSION}.${ZeroMQ_PATCH_VERSION}")
set(ZeroMQ_VERSION ${ZeroMQ_VER})

add_library(libzmq INTERFACE IMPORTED)
set_property(TARGET libzmq PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${ZeroMQ_INCLUDE_DIRS})
set_property(TARGET libzmq PROPERTY INTERFACE_LINK_LIBRARIES ${ZeroMQ_LIBRARIES})

add_library(libzmq-static INTERFACE IMPORTED)
set_property(TARGET libzmq-static PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${ZeroMQ_INCLUDE_DIRS})
set_property(TARGET libzmq-static PROPERTY INTERFACE_LINK_LIBRARIES ${ZeroMQ_LIBRARIES})
