From: Kefu Chai Date: Mon, 2 May 2022 03:42:17 +0000 (+0800) Subject: cmake/modules/BuildFIO: specify the full path to alloc libraries X-Git-Tag: v17.2.6~21^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cbb9dfcc8940bce0b48066b8c25845720e5ae2aa;p=ceph.git cmake/modules/BuildFIO: specify the full path to alloc libraries before this change, we assume that "ALLOCATOR" is the library name which can be found by linker with "ld -l ". but ideally, cmake can find a library in a more sophiscated way used by its "find_library()" implementation. so, in this change, instead of relying on the default paths looked up by "ld", use the path found by cmake. Signed-off-by: Kefu Chai (cherry picked from commit 5e3d92243a103903d30875f7064bf17c8a8cf588) --- diff --git a/cmake/modules/BuildFIO.cmake b/cmake/modules/BuildFIO.cmake index 481f3edf09d2..3a0694b543ee 100644 --- a/cmake/modules/BuildFIO.cmake +++ b/cmake/modules/BuildFIO.cmake @@ -2,8 +2,14 @@ function(build_fio) # we use an external project and copy the sources to bin directory to ensure # that object files are built outside of the source tree. include(ExternalProject) - if(ALLOCATOR) - set(FIO_EXTLIBS EXTLIBS=-l${ALLOCATOR}) + if(ALLOC_LIBS) + get_target_property(alloc_lib_path + ${ALLOC_LIBS} IMPORTED_LOCATION) + get_filename_component(alloc_lib_dir + ${alloc_lib_path} DIRECTORY) + get_filename_component(alloc_lib_name + ${alloc_lib_path} NAME) + set(FIO_EXTLIBS "EXTLIBS='-L${alloc_lib_dir} -l:${alloc_lib_name}'") endif() include(FindMake) @@ -20,7 +26,7 @@ function(build_fio) SOURCE_DIR ${source_dir} BUILD_IN_SOURCE 1 CONFIGURE_COMMAND /configure - BUILD_COMMAND ${make_cmd} fio EXTFLAGS=-Wno-format-truncation ${FIO_EXTLIBS} + BUILD_COMMAND ${make_cmd} fio EXTFLAGS=-Wno-format-truncation "${FIO_EXTLIBS}" INSTALL_COMMAND cp /fio ${CMAKE_BINARY_DIR}/bin LOG_CONFIGURE ON LOG_BUILD ON