cmake: require 4.0.0 <= libfmt-dev < 5.0.0
FMT_VERSION is now living in fmt/core.h in libfmt >= 5.0, so we cannot
parse fmt/format.h for libfmt's version anymore. also we don't need
Findfmt.cmake now. because libfmt-dev 4.0 and up is required by seastar,
also it's libfmt-dev 3.x's cmake module which fails to offer fmt::fmt
target. in other words, it's safe to drop libfmt 3.x support. but 5.0.0
is not compatible with seastar, we will have failures like:
In file included from
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/include/seastar/core/aligned_buffer.hh:25:0,
from
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/include/seastar/core/reactor.hh:26,
from
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/include/seastar/core/alien.hh:35,
from
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/src/core/alien.cc:23:
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/include/seastar/core/print.hh:
In function 'seastar::sstring seastar::format(const char*, A&& ...)':
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/include/seastar/core/print.hh:135:10:
error: 'MemoryWriter' is not a member of 'fmt'
fmt::MemoryWriter out;
^~~~~~~~~~~~
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/include/seastar/core/print.hh:136:5:
error: 'out' was not declared in this scope
out.write(fmt, std::forward<A>(a)...);
^~~
so, we should build libfmt even if we have libfmt-dev 5.x
Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-08-02 11:04:30 +00:00
|
|
|
find_package(PkgConfig QUIET)
|
2018-07-19 16:14:03 +00:00
|
|
|
|
|
|
|
pkg_search_module(PC_cares
|
|
|
|
libcares)
|
|
|
|
|
|
|
|
find_path(c-ares_INCLUDE_DIR
|
|
|
|
NAMES ares_dns.h
|
|
|
|
PATHS ${PC_cares_INCLUDE_DIRS})
|
|
|
|
|
|
|
|
find_library(c-ares_LIBRARY
|
|
|
|
NAMES cares
|
|
|
|
PATHS ${PC_cares_LIBRARY_DIRS})
|
|
|
|
|
|
|
|
set(c-ares_VERSION ${PC_cares_VERSION})
|
|
|
|
|
cmake: require 4.0.0 <= libfmt-dev < 5.0.0
FMT_VERSION is now living in fmt/core.h in libfmt >= 5.0, so we cannot
parse fmt/format.h for libfmt's version anymore. also we don't need
Findfmt.cmake now. because libfmt-dev 4.0 and up is required by seastar,
also it's libfmt-dev 3.x's cmake module which fails to offer fmt::fmt
target. in other words, it's safe to drop libfmt 3.x support. but 5.0.0
is not compatible with seastar, we will have failures like:
In file included from
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/include/seastar/core/aligned_buffer.hh:25:0,
from
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/include/seastar/core/reactor.hh:26,
from
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/include/seastar/core/alien.hh:35,
from
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/src/core/alien.cc:23:
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/include/seastar/core/print.hh:
In function 'seastar::sstring seastar::format(const char*, A&& ...)':
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/include/seastar/core/print.hh:135:10:
error: 'MemoryWriter' is not a member of 'fmt'
fmt::MemoryWriter out;
^~~~~~~~~~~~
/home/smithfarm/src/ceph/smithfarm/ceph/src/seastar/include/seastar/core/print.hh:136:5:
error: 'out' was not declared in this scope
out.write(fmt, std::forward<A>(a)...);
^~~
so, we should build libfmt even if we have libfmt-dev 5.x
Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-08-02 11:04:30 +00:00
|
|
|
include(FindPackageHandleStandardArgs)
|
2018-07-19 16:14:03 +00:00
|
|
|
|
|
|
|
find_package_handle_standard_args(c-ares
|
|
|
|
REQUIRED_VARS
|
|
|
|
c-ares_INCLUDE_DIR
|
|
|
|
c-ares_LIBRARY
|
|
|
|
VERSION_VAR c-ares_VERSION)
|
|
|
|
|
2022-11-21 16:44:31 +00:00
|
|
|
if(c-ares_FOUND AND NOT (TARGET c-ares::cares))
|
|
|
|
add_library(c-ares::cares UNKNOWN IMPORTED)
|
|
|
|
set_target_properties(c-ares::cares PROPERTIES
|
2018-07-19 16:14:03 +00:00
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${c-ares_INCLUDE_DIR}"
|
|
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
|
|
|
IMPORTED_LOCATION "${c-ares_LIBRARY}")
|
2022-11-21 16:44:31 +00:00
|
|
|
# to be compatible with old Seastar
|
|
|
|
add_library(c-ares::c-ares ALIAS c-ares::cares)
|
2018-07-19 16:14:03 +00:00
|
|
|
endif()
|