Commit 77c6b3a7 authored by Thomas Ives's avatar Thomas Ives
Browse files

cmake: Remove directory

These cmake find modules are no longer required as they provided by
TangoCMakeModules
parent 13624574
Loading
Loading
Loading
Loading
+0 −218
Original line number Diff line number Diff line
#[=======================================================================[.rst:
FindMySQL
---------

Find MySQL library

Imported Targets
^^^^^^^^^^^^^^^^

This module provides the following imported targets, if found:

    ``MySQL::MySQL``
    The MySQL client library
    ``MySQL::exe``
    The MySQL client executable

Result Variables
^^^^^^^^^^^^^^^^

This will define the following variables:

    ``MySQL_FOUND``
    True if the system has the MySQL library.
    ``MySQL_exe_FOUND``
    True if the system has the MySQL library.
    ``MySQL_VERSION``
    The version of the MySQL library which was found, if known

Cache Variables
^^^^^^^^^^^^^^^

The following cache variables may also be set:

    ``MySQL_INCLUDE_DIR``
    The directory containing ``mysql.h``.
    ``MySQL_LIBRARY_RELEASE``
    The path to the release MySQL library.
    ``MySQL_LIBRARY_DEBUG``
    The path to the debug MySQL library.
    ``MySQL_LIBRARY``
    The path to the release MySQL library or the debug library
    if the release library is not found.
    ``MySQL_EXECUTABLE``
    The path to the mysql client program

#]=======================================================================]

if (NOT DEFINED PKG_CONFIG_FOUND)
    find_package(PkgConfig QUIET)
endif()

# Collect hints from pkg-config
if (PKG_CONFIG_FOUND)
    pkg_search_module(_MySQL_PKG mysql mariadb QUIET)
endif()

if (WIN32)
    set(_mysql_inc_paths
        "$ENV{ProgramFiles}/MySQL/*/include"
        "$ENV{ProgramFiles\(x86\)}/MySQL/*/include"
        "$ENV{ProgramFiles}/MariaDB/*/include"
        "$ENV{ProgramFiles\(x86\)}/MariaDB/*/include"
        "$ENV{ProgramFiles}/MariaDB/include"
        "$ENV{ProgramFiles\(x86\)}/MariaDB/include"
        )
endif()

find_path(MySQL_INCLUDE_DIR
    NAMES "mysql.h"
    PATHS
        ${_mysql_inc_paths}
        "${_MySQL_PKG_INCLUDE_DIRS}"
    PATH_SUFFIXES mysql mariadb
    )
unset(_mysql_inc_paths)

if (WIN32)
    set(_mysql_release_names libmariadb libmysql)
    set(_mysql_debug_names libmariadbd libmysqld)
    set(_mysql_lib_paths
        "$ENV{ProgramFiles}/MySQL/*/lib"
        "$ENV{ProgramFiles\(x86\)}/MySQL/*/lib"
        "$ENV{ProgramFiles}/MariaDB/*/lib"
        "$ENV{ProgramFiles\(x86\)}/MariaDB/*/lib"
        "$ENV{ProgramFiles}/MariaDB/lib"
        "$ENV{ProgramFiles\(x86\)}/MariaDB/lib"
        )
else()
    set(_mysql_release_names mariadb mysqlclient mysqlclient_r)
    set(_mysql_debug_names mariadb mysqlclient mysqlclient_r)
endif()

find_library(MySQL_LIBRARY_RELEASE
    NAMES ${_mysql_release_names}
    NAMES_PER_DIR
    PATHS
        ""
        ${_mysql_lib_paths}
        ${_MySQL_PKG_LIBRARY_DIRS}
    )

find_library(MySQL_LIBRARY_DEBUG
    NAMES ${_mysql_debug_names}
    NAMES_PER_DIR
    PATHS
        ""
        ${_mysql_lib_paths}
        ${_MySQL_PKG_LIBRARY_DIRS}
    )

unset(_mysql_lib_paths)
unset(_mysql_release_names)
unset(_mysql_debug_names)

include(SelectLibraryConfigurations)
select_library_configurations(MySQL)

if (WIN32)
    set(_mysql_bin_paths
        "$ENV{ProgramFiles}/MySQL/*/bin"
        "$ENV{ProgramFiles\(x86\)}/MySQL/*/bin"
        "$ENV{ProgramFiles}/MariaDB/*/bin"
        "$ENV{ProgramFiles\(x86\)}/MariaDB/*/bin"
        "$ENV{ProgramFiles}/MariaDB/bin"
        "$ENV{ProgramFiles\(x86\)}/MariaDB/bin"
        )
endif()

find_program(MySQL_EXECUTABLE
    NAMES mariadb mysql
    NAMES_PER_DIR
    PATHS
        ${_mysql_bin_paths}
    )

if (MySQL_EXECUTABLE)
    set(MySQL_exe_FOUND TRUE)
endif()

if (NOT MySQL_INCLUDE_DIR OR
    (CMAKE_CROSSCOMPILING AND NOT CMAKE_CROSSCOMPILING_EMULATOR))
    set(MySQL_VERSION MySQL_VERSION-NOTFOUND)
endif()

if(NOT DEFINED MySQL_VERSION)
    try_run(
        DB_CLIENT_RUN
        DB_CLIENT_COMPILE
        ${CMAKE_CURRENT_BINARY_DIR}
        ${CMAKE_CURRENT_LIST_DIR}/test_db_client.cpp
        COMPILE_DEFINITIONS "-I \"${MySQL_INCLUDE_DIR}\""
        LINK_LIBRARIES ${MySQL_LIBRARY}
        COMPILE_OUTPUT_VARIABLE DB_CLIENT_COMPILE_OUTPUT
        RUN_OUTPUT_VARIABLE DB_CLIENT_VERSION)

    if (NOT DB_CLIENT_COMPILE)
      message(FATAL_ERROR "Failed to compile simple database client program:\n${DB_CLIENT_COMPILE_OUTPUT}")
    endif()

    if (NOT DB_CLIENT_RUN EQUAL 0)
      message(FATAL_ERROR "Failed to run simple database client program:\n${DB_CLIENT_VERSION}")
    endif()

    string(STRIP "${DB_CLIENT_VERSION}" DB_CLIENT_VERSION)
    set(MySQL_VERSION ${DB_CLIENT_VERSION} CACHE INTERNAL "database client library version")
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MySQL
    FOUND_VAR MySQL_FOUND
    REQUIRED_VARS
        MySQL_LIBRARY
        MySQL_INCLUDE_DIR
    VERSION_VAR MySQL_VERSION
    HANDLE_COMPONENTS)

if (MySQL_FOUND)
    mark_as_advanced(MySQL_INCLUDE_DIR)
    mark_as_advanced(MySQL_LIBRARY_RELEASE)
    mark_as_advanced(MySQL_LIBRARY_DEBUG)
    mark_as_advanced(MySQL_LIBRARY)
endif()

if (MySQL_FOUND)
    if (NOT TARGET MySQL::MySQL)
        add_library(MySQL::MySQL UNKNOWN IMPORTED)
    endif()
    if (MySQL_LIBRARY_RELEASE)
        set_property(TARGET MySQL::MySQL APPEND PROPERTY
            IMPORTED_CONFIGURATIONS RELEASE
        )
        set_target_properties(MySQL::MySQL PROPERTIES
            IMPORTED_LOCATION_RELEASE "${MySQL_LIBRARY_RELEASE}"
        )
    endif()
    if (MySQL_LIBRARY_DEBUG)
        set_property(TARGET MySQL::MySQL APPEND PROPERTY
            IMPORTED_CONFIGURATIONS DEBUG
        )
        set_target_properties(MySQL::MySQL PROPERTIES
            IMPORTED_LOCATION_DEBUG "${MySQL_LIBRARY_DEBUG}"
        )
    endif()
    set_target_properties(MySQL::MySQL PROPERTIES
        INTERFACE_INCLUDE_DIRECTORIES "${MySQL_INCLUDE_DIR}"
        INTERFACE_DEFINITIONS "${_MySQL_PKG_CFLAGS_OTHER}"
        )
endif()

if (MySQL_exe_FOUND)
    mark_as_advanced(MySQL_EXECUTABLE)
endif()

if (MySQL_exe_FOUND AND NOT TARGET MySQL::exe)
    add_executable(MySQL::exe IMPORTED)
    set_property(TARGET MySQL::exe PROPERTY IMPORTED_LOCATION "${MySQL_EXECUTABLE}")
endif()
+0 −299
Original line number Diff line number Diff line
#[=======================================================================[.rst:
FindTango
---------

Find Tango library

Imported Targets
^^^^^^^^^^^^^^^^

This module provides the following imported targets, if found:

``Tango::Tango``
  The Tango library

Result Variables
^^^^^^^^^^^^^^^^

This will define the following variables:

    ``Tango_FOUND``
    True if the system has the Tango library.

Cache Variables
^^^^^^^^^^^^^^^

The following cache vairables can be used to control the behaviour of this find
module.

    ``Tango_USE_PKG_CONFIG``
    Set to OFF to disable using pkg-config to find Tango.
    ``Tango_FORCE_STATIC``
    Force Tango to use static libraries

The following cache variables may also be set:

    ``Tango_INCLUDE_DIR``
    The directory containing ``tango/tango.h``.
    ``Tango_LIBRARY``
    The path to the Tango library.

#]=======================================================================]

function(_tango_find_version)
    if (NOT Tango_INCLUDE_DIR)
        set(Tango_VERSION Tango_VERSION-NOTFOUND PARENT_SCOPE)
        return()
    endif()

# File containing version information.  We should find it under tango for 9.3.x
# releases and under tango/common for post 9.4.0 releases.
    find_file(tango_const_include_file
        NAMES tango_const.h
        PATHS
            ${Tango_INCLUDE_DIR}/tango
            ${Tango_INCLUDE_DIR}/tango/common
        NO_DEFAULT_PATH
    )

    if (NOT tango_const_include_file)
        message(WARNING "Could not fine tango_const.h under ${Tango_INCLUDE_DIR}")
        set(Tango_VERSION Tango_VERSION-NOTFOUND PARENT_SCOPE)
        return()
    endif()

    file(STRINGS ${tango_const_include_file} version_info
        REGEX "^#define[ \t]+TANGO_VERSION_(MAJOR|MINOR|PATCH).*")
    unset(tango_const_include_file CACHE)

    list(LENGTH version_info version_info_length)

    if (NOT version_info_length EQUAL 3)
        message(WARNING "Could not find version information in ${tango_const_include_file}")
        set(Tango_VERSION Tango_VERSION-NOTFOUND PARENT_SCOPE)
        return()
    endif()

    list(GET version_info 0 version_major_info)
    list(GET version_info 1 version_minor_info)
    list(GET version_info 2 version_patch_info)

    string(REGEX REPLACE "^#define[ \t]+TANGO_VERSION_MAJOR[ \t]+([0-9]+)$" "\\1" version_major ${version_major_info})
    string(REGEX REPLACE "^#define[ \t]+TANGO_VERSION_MINOR[ \t]+([0-9]+)$" "\\1" version_minor ${version_minor_info})
    string(REGEX REPLACE "^#define[ \t]+TANGO_VERSION_PATCH[ \t]+([0-9]+)$" "\\1" version_patch ${version_patch_info})

    set(Tango_VERSION ${version_major}.${version_minor}.${version_patch} CACHE INTERNAL "Tango Version")
    set(Tango_VERSION_MAJOR ${version_major} PARENT_SCOPE)
    set(Tango_VERSION_MINOR ${version_minor} PARENT_SCOPE)
    set(Tango_VERSION_PATCH ${version_patch} PARENT_SCOPE)
endfunction()

if (WIN32)
    set(_tango_default_use_pkg_config OFF)
else()
    set(_tango_default_use_pkg_config ON)
endif()
option(Tango_USE_PKG_CONFIG "Use pkg-config to find Tango" ${_tango_default_use_pkg_config})
unset(_tango_default_use_pkg_config)

option(Tango_FORCE_STATIC "Statically link Tango" OFF)
if(Tango_FORCE_STATIC AND Tango_USE_PKG_CONFIG)
    message(STATUS "Cannot set -DTango_FORCE_STATIC and -DTango_USE_PKG_CONFIG at the same time.  Forcing -DTango_USE_PKG_CONFIG to OFF")
    set(Tango_USE_PKG_CONFIG OFF)
endif()

if (NOT Tango_USE_PKG_CONFIG OR Tango_FIND_QUIETLY)
    set(_tango_pkg_config_quiet QUIET)
endif()
find_package(PkgConfig ${_tango_pkg_config_quiet})
unset(_tango_pkg_config_quiet)
if (PKG_CONFIG_FOUND)
    if (Tango_FIND_REQUIRED AND NOT Tango_FIND_QUIETLY AND Tango_USE_PKG_CONFIG)
        pkg_search_module(_Tango_PKG tango IMPORTED_TARGET)
    else()
        pkg_search_module(_Tango_PKG tango QUIET IMPORTED_TARGET)
    endif()
endif()

if (_Tango_PKG_FOUND AND Tango_USE_PKG_CONFIG)
    if (NOT TARGET Tango::Tango)
        add_library(Tango::Tango ALIAS PkgConfig::_Tango_PKG)
    endif()
    if (NOT Tango_FIND_QUIETLY)
        message(STATUS "Tango found via pkg-config")
    endif()
    set(Tango_FOUND TRUE)
    return()
endif()

if (NOT _Tango_PKG_FOUND AND Tango_USE_PKG_CONFIG AND NOT Tango_FIND_QUIETLY)
    message(STATUS "Tango not found via pkg-config, falling back to cmake find")
endif()

# This will not find the header file for the (Windows?) 9.3.5 release, however,
# I don't think this device server will work with the 9.3.5 release.
find_path(Tango_INCLUDE_DIR
    NAMES tango/tango.h
    PATHS "" ${_Tango_PKG_INCLUDE_DIRS}
)

_tango_find_version()

if (WIN32)
    set(_tango_release_names tango)
    set(_tango_debug_names tangod)
    set(_tango_static_release_names libtango)
    set(_tango_static_debug_names libtangod)
else()
    set(_tango_release_names tango)
    set(_tango_debug_names tango)
    set(_tango_static_release_names tango)
    set(_tango_static_debug_names tango)
endif()

find_library(Tango_LIBRARY_RELEASE
    NAMES ${_tango_release_names}
    PATHS "" ${_Tango_PKG_LIBRARY_DIRS}
)

find_library(Tango_LIBRARY_RELEASE
    NAMES ${_tango_static_release_names}
    PATHS "" ${_Tango_PKG_LIBRARY_DIRS}
)

find_library(Tango_LIBRARY_DEBUG
    NAMES ${_tango_debug_names}
    PATHS "" ${_Tango_PKG_LIBRARY_DIRS}
)

find_library(Tango_LIBRARY_DEBUG
    NAMES ${_tango_static_debug_names}
    PATHS "" ${_Tango_PKG_LIBRARY_DIRS}
)

find_library(Tango_static_LIBRARY_RELEASE
    NAMES ${_tango_static_release_names}
    PATHS "" ${_Tango_PKG_LIBRARY_DIRS}
)

find_library(Tango_static_LIBRARY_DEBUG
    NAMES ${_tango_static_debug_names}
    PATHS "" ${_Tango_PKG_LIBRARY_DIRS}
)

unset(_tango_release_names)
unset(_tango_debug_names)
unset(_tango_static_release_names)
unset(_tango_static_debug_names)

include(SelectLibraryConfigurations)
select_library_configurations(Tango)
select_library_configurations(Tango_static)

if(Tango_LIBRARY STREQUAL Tango_static_LIBRARY)
    set(Tango_IS_STATIC TRUE)
endif()

if (Tango_static_LIBRARY)
    set(Tango_static_FOUND TRUE)
endif()

if(Tango_FIND_QUIETLY)
    set(_tango_quiet QUIET)
endif()

find_package(cppzmq ${_tango_quiet})
find_package(omniORB4 ${_tango_quiet}
    COMPONENTS COS4 Dynamic4)
unset(_tango_quiet)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Tango
    FOUND_VAR Tango_FOUND
    REQUIRED_VARS
        Tango_LIBRARY
        Tango_INCLUDE_DIR
        cppzmq_FOUND
        omniORB4_FOUND
        omniORB4_COS4_FOUND
        omniORB4_Dynamic4_FOUND
    VERSION_VAR Tango_VERSION
)

if (Tango_FOUND)
    mark_as_advanced(Tango_INCLUDE_DIR)
    mark_as_advanced(Tango_LIBRARY)
    mark_as_advanced(Tango_LIBRARY_RELEASE)
    mark_as_advanced(Tango_LIBRARY_DEBUG)
endif()

if (Tango_static_FOUND)
    mark_as_advanced(Tango_static_LIBRARY)
    mark_as_advanced(Tango_static_LIBRARY_RELEASE)
    mark_as_advanced(Tango_static_LIBRARY_DEBUG)
endif()

function(_tango_add_target prefix targetsuffix is_static)
    if (NOT TARGET Tango::Tango)
        add_library(Tango::Tango UNKNOWN IMPORTED)
    endif()

    if (${prefix}_LIBRARY_RELEASE)
        set_property(TARGET Tango::Tango APPEND PROPERTY
            IMPORTED_CONFIGURATIONS RELEASE
        )
        set_target_properties(Tango::Tango PROPERTIES
            IMPORTED_LOCATION_RELEASE "${${prefix}_LIBRARY_RELEASE}"
        )
    endif()
    if (${prefix}_LIBRARY_DEBUG)
        set_property(TARGET Tango::Tango APPEND PROPERTY
            IMPORTED_CONFIGURATIONS DEBUG
        )
        set_target_properties(Tango::Tango PROPERTIES
            IMPORTED_LOCATION_DEBUG "${${prefix}_LIBRARY_DEBUG}"
        )
    endif()

    set(_tango_inc_dirs "${Tango_INCLUDE_DIR}")
    # For the 9.3.6 release the header files include each other without the "tango/" prefix, however,
    # our device server is including "tango/tango.h" so we need both directories in our include dirs.
    if (Tango_VERSION VERSION_LESS 9.4.0)
        list(APPEND _tango_inc_dirs "${Tango_INCLUDE_DIR}/tango")
    endif()

    set(_tango_dependents
        cppzmq::cppzmq${targetsuffix}
        omniORB4::omniORB4${targetsuffix}
        omniORB4::COS4${targetsuffix}
        omniORB4::Dynamic4${targetsuffix})

    if (WIN32)
        if(NOT is_static)
            set(_tango_definitions /DTANGO_HAS_DLL /DLOG4TANGO_HAS_DLL)
        else()
            set(_tango_definitions /D_WINSTATIC)
            list(APPEND _tango_dependents comctl32.lib)
        endif()
    endif()

    set_target_properties(Tango::Tango PROPERTIES
        INTERFACE_INCLUDE_DIRECTORIES "${_tango_inc_dirs}"
        INTERFACE_COMPILE_OPTIONS "${_tango_definitions}"
        INTERFACE_LINK_LIBRARIES "${_tango_dependents}"
        )

    unset(_tango_inc_dirs)
    unset(_tango_dependents)
    unset(_tango_defintions)
endfunction()

if (Tango_FORCE_STATIC AND NOT Tango_static_FOUND)
    message(FATAL_ERROR "Could not find static Tango when forcing static")
endif()

if (Tango_FORCE_STATIC)
    _tango_add_target(Tango_static "-static" TRUE)
elseif (Tango_FOUND)
    _tango_add_target(Tango "" "${Tango_IS_STATIC}")
endif()
+0 −202
Original line number Diff line number Diff line
#[=======================================================================[.rst:
FindZeroMQ
---------

Find the ZeroMQ library

Imported Targets
^^^^^^^^^^^^^^^^

This module provides the following imported targets, if found:

    ``ZeroMQ::ZeroMQ``
    The ZeroMQ library.  On Windows this will always be a shared library, on other platforms this will be whatever is found.
    ``ZeroMQ::ZeroMQ-static``
    The ZeroMQ static library

Result Variables
^^^^^^^^^^^^^^^^

This will define the following variables:

    ``ZeroMQ_FOUND``
    True if the required components have been found.
    ``ZeroMQ_static_FOUND``
    True if the system has the C++ ZeroMQ static library.
    ``ZeroMQ_IS_STATIC``
    True if ``ZeroMQ::ZeroMQ`` and ``ZeroMQ::ZeroMQ-static`` are the same.

Cache Variables
^^^^^^^^^^^^^^^

The following cache variables may also be set:

    ``ZeroMQ_INCLUDE_DIR``
    The directory containing ``zmq.hpp``.
    ``ZeroMQ_shared_LIBRARY_RELEASE``
    The path to the release ZeroMQ library.
    ``ZeroMQ_shared_LIBRARY_DEBUG``
    The path to the debug ZeroMQ library.
    ``ZeroMQ_shared_LIBRARY``
    The path to the release ZeroMQ library, or the debug library
    if the release library is not found
    ``ZeroMQ_static_LIBRARY_RELEASE``
    The path to the release ZeroMQ library.
    ``ZeroMQ_static_LIBRARY_DEBUG``
    The path to the debug ZeroMQ library.
    ``ZeroMQ_static_LIBRARY``
    The path to the release ZeroMQ library, or the debug library
    if the release library is not found

#]=======================================================================]

if (NOT DEFINED PKG_CONFIG_FOUND)
    find_package(PkgConfig QUIET)
endif()

# Collect hints from pkg-config
if (PKG_CONFIG_FOUND)
    pkg_search_module(_ZeroMQ_PKG libzmq QUIET)
endif()

find_path(ZeroMQ_INCLUDE_DIR
    NAMES "zmq.h"
    PATHS "" ${_ZeroMQ_PKG_INCLUDE_DIRS}
)

if(WIN32)
    set(_zmq_versions "4_0_5" "4_3_4")
    set(_zmq_vc_versions "v141" "v142")

    foreach(ver IN LISTS _zmq_versions)
        foreach(vc_ver IN LISTS _zmq_vc_versions)
            list(APPEND _zmq_lib_release_names "libzmq-${vc_ver}-mt-${ver}.lib")
            list(APPEND _zmq_lib_debug_names "libzmq-${vc_ver}-mt-gd-${ver}.lib")
            list(APPEND _zmq_lib_static_release_names "libzmq-${vc_ver}-mt-s-${ver}.lib")
            list(APPEND _zmq_lib_static_debug_names "libzmq-${vc_ver}-mt-sgd-${ver}.lib")
        endforeach(vc_ver IN LISTS VC_VERSIONS)
    endforeach(ver IN ZMQ_VERSIONS)

    unset(_zmq_versions)
    unset(_zmq_vc_versions)
else()
    set(_zmq_lib_release_names "zmq")
    set(_zmq_lib_debug_names "zmq")
    set(_zmq_lib_static_release_names "libzmq.a")
    set(_zmq_lib_static_debug_names "libzmq.a")
endif(WIN32)

find_library(ZeroMQ_LIBRARY_RELEASE
    NAMES ${_zmq_lib_release_names}
    PATHS "" ${_ZeroMQ_PKG_LIBRARY_DIRS}
)

find_library(ZeroMQ_LIBRARY_RELEASE
    NAMES ${_zmq_lib_static_release_names}
    PATHS "" ${_ZeroMQ_PKG_LIBRARY_DIRS}
)

find_library(ZeroMQ_LIBRARY_DEBUG
    NAMES ${_zmq_lib_debug_names}
    PATHS "" ${_ZeroMQ_PKG_LIBRARY_DIRS}
)

find_library(ZeroMQ_LIBRARY_DEBUG
    NAMES ${_zmq_lib_static_debug_names}
    PATHS "" ${_ZeroMQ_PKG_LIBRARY_DIRS}
)

find_library(ZeroMQ_static_LIBRARY_RELEASE
    NAMES ${_zmq_lib_static_release_names}
    NAMES_PER_DIR
    PATHS "" ${_ZeroMQ_PKG_LIBRARY_DIRS}
)

find_library(ZeroMQ_static_LIBRARY_DEBUG
    NAMES ${_zmq_lib_static_debug_names}
    NAMES_PER_DIR
    PATHS "" ${_ZeroMQ_PKG_LIBRARY_DIRS}
)

unset(_zmq_lib_release_names)
unset(_zmq_lib_debug_names)
unset(_zmq_lib_static_release_names)
unset(_zmq_lib_static_debug_names)

include(SelectLibraryConfigurations)
select_library_configurations(ZeroMQ)
select_library_configurations(ZeroMQ_static)

if (ZeroMQ_static_LIBRARY)
    set(ZeroMQ_static_FOUND TRUE)
endif()

if (ZeroMQ_LIBRARY STREQUAL ZeroMQ_static_LIBRARY)
    set(ZeroMQ_IS_STATIC TRUE)
else()
    set(ZeroMQ_IS_STATIC FALSE)
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ZeroMQ
    REQUIRED_VARS
        ZeroMQ_LIBRARY
        ZeroMQ_INCLUDE_DIR
)

if (ZeroMQ_FOUND)
    mark_as_advanced(ZeroMQ_INCLUDE_DIR)
    mark_as_advanced(ZeroMQ_LIBRARY)
    mark_as_advanced(ZeroMQ_LIBRARY_RELEASE)
    mark_as_advanced(ZeroMQ_LIBRARY_DEBUG)
endif()

if (ZeroMQ_static_FOUND)
    mark_as_advanced(ZeroMQ_static_LIBRARY)
    mark_as_advanced(ZeroMQ_static_LIBRARY_RELEASE)
    mark_as_advanced(ZeroMQ_static_LIBRARY_DEBUG)
endif()

if (ZeroMQ_FOUND)
    if (NOT TARGET ZeroMQ::ZeroMQ)
        add_library(ZeroMQ::ZeroMQ UNKNOWN IMPORTED)
    endif()
    if (ZeroMQ_LIBRARY_RELEASE)
        set_property(TARGET ZeroMQ::ZeroMQ APPEND PROPERTY
            IMPORTED_CONFIGURATIONS RELEASE)
        set_target_properties(ZeroMQ::ZeroMQ PROPERTIES
            IMPORTED_LOCATION_RELEASE "${ZeroMQ_LIBRARY_RELEASE}")
    endif()
    if (ZeroMQ_LIBRARY_DEBUG)
        set_property(TARGET ZeroMQ::ZeroMQ APPEND PROPERTY
            IMPORTED_CONFIGURATIONS DEBUG)
        set_target_properties(ZeroMQ::ZeroMQ PROPERTIES
            IMPORTED_LOCATION_DEBUG "${ZeroMQ_LIBRARY_DEBUG}")
    endif()
    set_target_properties(ZeroMQ::ZeroMQ PROPERTIES
        INTERFACE_INCLUDE_DIRECTORIES "${ZeroMQ_INCLUDE_DIR}"
        INTERFACE_DEFINITIONS "${_ZeroMQ_PKG_CFLAGS_OTHER}"
    )
endif()

if (ZeroMQ_static_FOUND)
    if (NOT TARGET ZeroMQ::ZeroMQ-static)
        add_library(ZeroMQ::ZeroMQ-static UNKNOWN IMPORTED)
    endif()
   if (ZeroMQ_static_LIBRARY_RELEASE)
        set_property(TARGET ZeroMQ::ZeroMQ-static APPEND PROPERTY
            IMPORTED_CONFIGURATIONS RELEASE)
        set_target_properties(ZeroMQ::ZeroMQ-static PROPERTIES
            IMPORTED_LOCATION_RELEASE "${ZeroMQ_static_LIBRARY_RELEASE}")
    endif()
    if (ZeroMQ_static_LIBRARY_DEBUG)
        set_property(TARGET ZeroMQ::ZeroMQ-static APPEND PROPERTY
            IMPORTED_CONFIGURATIONS DEBUG)
        set_target_properties(ZeroMQ::ZeroMQ-static PROPERTIES
            IMPORTED_LOCATION_DEBUG "${ZeroMQ_static_LIBRARY_DEBUG}")
    endif()
    set_target_properties(ZeroMQ::ZeroMQ-static PROPERTIES
        INTERFACE_INCLUDE_DIRECTORIES "${ZeroMQ_INCLUDE_DIR}"
        INTERFACE_DEFINITIONS "${_ZeroMQ_PKG_CFLAGS_OTHER}"
    )
endif()
+0 −103
Original line number Diff line number Diff line
#[=======================================================================[.rst:
Findcppzmq
---------

Find the C++ ZeroMQ library

Imported Targets
^^^^^^^^^^^^^^^^

This module provides the following imported targets, if found:

    ``cppzmq::cppzmq``
    The C++ ZeroMQ library
    ``cppzmq::cppzmq-static``
    The C++ ZeroMQ library

Result Variables
^^^^^^^^^^^^^^^^

This will define the following variables:

    ``cppzmq_FOUND``
    True if the system has the C++ ZeroMQ library.
    ``cppzmq_static_FOUND``
    True if the system has the static C++ ZeroMQ library.
    ``cppzmq_IS_STTAIC``
    True if ``cppzmq::cppzmq-static`` is the same as ``cppzmq::cppzmq``.

Cache Variables
^^^^^^^^^^^^^^^

The following cache variables may also be set:

    ``cppzmq_INCLUDE_FILE``
    The path to ``zmq.hpp`` file.
    ``cppzmq_INCLUDE_DIR``
    The directory containing ``zmq.hpp``.

#]=======================================================================]

if (NOT DEFINED PKG_CONFIG_FOUND)
    find_package(PkgConfig QUIET)
endif()

# Collect hints from pkg-config
if (PKG_CONFIG_FOUND)
    pkg_search_module(_cppzmq_PKG cppzmq QUIET)
endif()

find_path(cppzmq_INCLUDE_DIR
    NAMES zmq.hpp
    PATHS "${_cppzmq_PKG_INCLUDE_DIRS}"
)

# Find the include file just so we can report it in
# find_package_handle_standard_args
find_file(cppzmq_INCLUDE_FILE
    NAMES zmq.hpp
    PATHS "" ${_cppzmq_PKG_INCLUDE_DIRS}
)

if (cppzmq_FIND_QUIETLY)
    set(_cppzmq_quiet QUIET)
endif()

find_package(ZeroMQ ${_cppzmq_quiet})
unset(_cppzmq_required)
unset(_cppzmq_quiet)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(cppzmq
    REQUIRED_VARS
        cppzmq_INCLUDE_FILE
        cppzmq_INCLUDE_DIR
        ZeroMQ_FOUND
)

if(ZeroMQ_static_FOUND AND cppzmq_FOUND)
    set(cppzmq_static_FOUND TRUE)
    set(cppzmq_IS_STATIC ${ZeroMQ_IS_STATIC})
endif()

if (cppzmq_FOUND)
    mark_as_advanced(cppzmq_INCLUDE_FILE)
    mark_as_advanced(cppzmq_INCLUDE_DIR)
endif()

if (cppzmq_FOUND AND NOT TARGET cppzmq::cppzmq)
    add_library(cppzmq::cppzmq INTERFACE IMPORTED)
    set_target_properties(cppzmq::cppzmq PROPERTIES
        INTERFACE_INCLUDE_DIRS "${cppzmq_INCLUDE_DIR}"
        INTERFACE_LINK_LIBRARIES  ZeroMQ::ZeroMQ
    )
endif()

if(cppzmq_static_FOUND AND NOT TARGET cppzmq::cppzmq-static)
    set(cppzmq_static_FOUND TRUE)
    add_library(cppzmq::cppzmq-static INTERFACE IMPORTED)
    set_target_properties(cppzmq::cppzmq-static PROPERTIES
        INTERFACE_INCLUDE_DIRS "${cppzmq_INCLUDE_DIR}"
        INTERFACE_LINK_LIBRARIES  ZeroMQ::ZeroMQ-static
    )
endif()
+0 −336

File deleted.

Preview size limit exceeded, changes collapsed.

Loading