]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake/modules/BuildFIO: specify the full path to alloc libraries
authorKefu Chai <tchaikov@gmail.com>
Mon, 2 May 2022 03:42:17 +0000 (11:42 +0800)
committerKefu Chai <tchaikov@gmail.com>
Mon, 2 May 2022 04:40:55 +0000 (12:40 +0800)
before this change, we assume that "ALLOCATOR" is the library name
which can be found by linker with "ld -l <namespec>". 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 <tchaikov@gmail.com>
cmake/modules/BuildFIO.cmake

index 481f3edf09d228a20a2317df4cf809e5f0526de5..3a0694b543eed3e2ad4ed8c6be15bcc22d4a48f5 100644 (file)
@@ -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 <SOURCE_DIR>/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 <BINARY_DIR>/fio ${CMAKE_BINARY_DIR}/bin
     LOG_CONFIGURE ON
     LOG_BUILD ON