From 5e3d92243a103903d30875f7064bf17c8a8cf588 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 2 May 2022 11:42:17 +0800 Subject: [PATCH] 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 --- cmake/modules/BuildFIO.cmake | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmake/modules/BuildFIO.cmake b/cmake/modules/BuildFIO.cmake index 481f3edf09d..3a0694b543e 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 -- 2.39.5