From c976f142f0266f9b3b442eb9de20ad4fd055d2f9 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 9 Nov 2020 15:47:41 +0800 Subject: [PATCH] cmake: expose FIO_INCLUDE_DIR via libfio always use the fio built from source for better consistency. Signed-off-by: Kefu Chai --- CMakeLists.txt | 4 ---- cmake/modules/BuildFIO.cmake | 5 +++++ src/test/fio/CMakeLists.txt | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ae3dac66c612..e2da7739c26fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -507,10 +507,6 @@ set(CEPH_TEST_TIMEOUT 3600 CACHE STRING # fio option(WITH_FIO "build with fio plugin enabled" OFF) if(WITH_FIO) - if (NOT FIO_INCLUDE_DIR) - # Use local external fio if include directory is not set - set(FIO_INCLUDE_DIR ${CMAKE_BINARY_DIR}/src/fio) - endif() include(BuildFIO) build_fio() endif() diff --git a/cmake/modules/BuildFIO.cmake b/cmake/modules/BuildFIO.cmake index f0a9c0e332756..d3288cc330919 100644 --- a/cmake/modules/BuildFIO.cmake +++ b/cmake/modules/BuildFIO.cmake @@ -21,4 +21,9 @@ function(build_fio) CONFIGURE_COMMAND /configure BUILD_COMMAND ${make_cmd} fio EXTFLAGS=-Wno-format-truncation ${FIO_EXTLIBS} INSTALL_COMMAND cp /fio ${CMAKE_BINARY_DIR}/bin) + + add_library(fio INTERFACE IMPORTED) + add_dependencies(fio fio_ext) + set_target_properties(fio PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/src/fio) endfunction() diff --git a/src/test/fio/CMakeLists.txt b/src/test/fio/CMakeLists.txt index c55ef37bbb0e5..ceda247df710e 100644 --- a/src/test/fio/CMakeLists.txt +++ b/src/test/fio/CMakeLists.txt @@ -1,10 +1,10 @@ # ObjectStore add_library(fio_ceph_objectstore SHARED fio_ceph_objectstore.cc) -target_include_directories(fio_ceph_objectstore SYSTEM PUBLIC ${FIO_INCLUDE_DIR}) +target_link_libraries(fio_ceph_objectstore fio) # Messenger add_library(fio_ceph_messenger SHARED fio_ceph_messenger.cc) -target_include_directories(fio_ceph_messenger SYSTEM PUBLIC ${FIO_INCLUDE_DIR}) +target_link_libraries(fio_ceph_messenger fio) # prevent fio from adding 'typedef int bool' and gettid() if(HAVE_GETTID) -- 2.39.5