From: Kefu Chai Date: Sat, 24 Jul 2021 07:01:54 +0000 (+0800) Subject: cmake: use generator exp. for passing fmt::fmt's COMPILE_DEFINITIONS X-Git-Tag: v17.1.0~1280^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=99ba98cef0a840a2ddd9bd8ca4b3fda4330ddd5a;p=ceph.git cmake: use generator exp. for passing fmt::fmt's COMPILE_DEFINITIONS more concise this way, without yet another redirection. Signed-off-by: Kefu Chai --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1e7279c29721..e4672ccde966 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -388,15 +388,6 @@ set(CMAKE_EXTRA_INCLUDE_FILES "sys/time.h") CHECK_TYPE_SIZE(suseconds_t SUSECONDS_T) unset(CMAKE_EXTRA_INCLUDE_FILES) -function(compile_with_fmt target) - get_target_property(fmt_compile_definitions - fmt::fmt INTERFACE_COMPILE_DEFINITIONS) - if(fmt_compile_definitions) - target_compile_definitions(${target} PUBLIC - ${fmt_compile_definitions}) - endif() -endfunction() - set(libcommon_files ${CMAKE_BINARY_DIR}/src/include/ceph_ver.h ceph_ver.c @@ -434,7 +425,8 @@ endif() set_source_files_properties(ceph_ver.c APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/src/include/ceph_ver.h) add_library(common-objs OBJECT ${libcommon_files}) -compile_with_fmt(common-objs) +target_compile_definitions(common-objs PRIVATE + $) add_dependencies(common-objs legacy-option-headers) if(WITH_JAEGER) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index d905c9f974ab..1272130eb442 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -188,8 +188,8 @@ target_include_directories(common-common-objs PRIVATE ${OPENSSL_INCLUDE_DIR}) target_compile_definitions(common-common-objs PRIVATE "CMAKE_INSTALL_LIBDIR=\"${CMAKE_INSTALL_LIBDIR}\"" "CEPH_INSTALL_FULL_PKGLIBDIR=\"${CEPH_INSTALL_FULL_PKGLIBDIR}\"" - "CEPH_INSTALL_DATADIR=\"${CEPH_INSTALL_DATADIR}\"") -compile_with_fmt(common-common-objs) + "CEPH_INSTALL_DATADIR=\"${CEPH_INSTALL_DATADIR}\"" + $) add_dependencies(common-common-objs legacy-option-headers) set(common_mountcephfs_srcs diff --git a/src/msg/CMakeLists.txt b/src/msg/CMakeLists.txt index 9cca15c81555..1b9b11bc34e0 100644 --- a/src/msg/CMakeLists.txt +++ b/src/msg/CMakeLists.txt @@ -38,7 +38,8 @@ if(HAVE_RDMA) endif() add_library(common-msg-objs OBJECT ${msg_srcs}) -compile_with_fmt(common-msg-objs) +target_compile_definitions(common-msg-objs PRIVATE + $) target_include_directories(common-msg-objs PRIVATE ${OPENSSL_INCLUDE_DIR}) if(WITH_DPDK) diff --git a/src/neorados/CMakeLists.txt b/src/neorados/CMakeLists.txt index 8695b48f0f92..3c7aee7c6fea 100644 --- a/src/neorados/CMakeLists.txt +++ b/src/neorados/CMakeLists.txt @@ -1,9 +1,11 @@ add_library(neorados_objs OBJECT RADOSImpl.cc) -compile_with_fmt(neorados_objs) +target_compile_definitions(neorados_objs PRIVATE + $) add_library(neorados_api_obj OBJECT RADOS.cc) -compile_with_fmt(neorados_api_obj) +target_compile_definitions(neorados_api_obj PRIVATE + $) add_library(libneorados STATIC $