]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: use generator exp. for passing fmt::fmt's COMPILE_DEFINITIONS
authorKefu Chai <kchai@redhat.com>
Sat, 24 Jul 2021 07:01:54 +0000 (15:01 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 24 Jul 2021 11:28:56 +0000 (19:28 +0800)
more concise this way, without yet another redirection.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/CMakeLists.txt
src/common/CMakeLists.txt
src/msg/CMakeLists.txt
src/neorados/CMakeLists.txt

index 1e7279c29721c9aa0165e0ae9ff03bf29566e954..e4672ccde966609875afe6158d944bd94286d230 100644 (file)
@@ -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
+  $<TARGET_PROPERTY:fmt::fmt,INTERFACE_COMPILE_DEFINITIONS>)
 add_dependencies(common-objs legacy-option-headers)
 
 if(WITH_JAEGER)
index d905c9f974ab701f312f76131bd455a57aea9552..1272130eb4423e94edecb54cd4c8d35aebeaf6b9 100644 (file)
@@ -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}\""
+  $<TARGET_PROPERTY:fmt::fmt,INTERFACE_COMPILE_DEFINITIONS>)
 add_dependencies(common-common-objs legacy-option-headers)
 
 set(common_mountcephfs_srcs
index 9cca15c81555a89ebbb179d55182b2e96c3259ca..1b9b11bc34e0e8f5a38b215a0b36444320b66042 100644 (file)
@@ -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_PROPERTY:fmt::fmt,INTERFACE_COMPILE_DEFINITIONS>)
 target_include_directories(common-msg-objs PRIVATE ${OPENSSL_INCLUDE_DIR})
 
 if(WITH_DPDK)
index 8695b48f0f924fb757a2dc34326a69591eeb05a1..3c7aee7c6fea02a00d2246822cad554adc27e590 100644 (file)
@@ -1,9 +1,11 @@
 add_library(neorados_objs OBJECT
   RADOSImpl.cc)
-compile_with_fmt(neorados_objs)
+target_compile_definitions(neorados_objs PRIVATE
+  $<TARGET_PROPERTY:fmt::fmt,INTERFACE_COMPILE_DEFINITIONS>)
 add_library(neorados_api_obj OBJECT
   RADOS.cc)
-compile_with_fmt(neorados_api_obj)
+target_compile_definitions(neorados_api_obj PRIVATE
+  $<TARGET_PROPERTY:fmt::fmt,INTERFACE_COMPILE_DEFINITIONS>)
 
 add_library(libneorados STATIC
   $<TARGET_OBJECTS:neorados_api_obj>