2018-02-21 12:03:23 +00:00
|
|
|
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)
|
2018-09-06 13:49:01 +00:00
|
|
|
if(ALLOCATOR)
|
|
|
|
set(FIO_EXTLIBS EXTLIBS=-l${ALLOCATOR})
|
|
|
|
endif()
|
2020-11-09 07:34:55 +00:00
|
|
|
|
|
|
|
include(FindMake)
|
|
|
|
find_make("MAKE_EXECUTABLE" "make_cmd")
|
|
|
|
|
2018-02-21 12:03:23 +00:00
|
|
|
ExternalProject_Add(fio_ext
|
|
|
|
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/src/
|
|
|
|
UPDATE_COMMAND "" # this disables rebuild on each run
|
|
|
|
GIT_REPOSITORY "https://github.com/axboe/fio.git"
|
2020-08-25 04:34:15 +00:00
|
|
|
GIT_CONFIG advice.detachedHead=false
|
|
|
|
GIT_SHALLOW 1
|
2019-11-11 22:19:29 +00:00
|
|
|
GIT_TAG "fio-3.15"
|
2018-02-21 12:03:23 +00:00
|
|
|
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/fio
|
|
|
|
BUILD_IN_SOURCE 1
|
|
|
|
CONFIGURE_COMMAND <SOURCE_DIR>/configure
|
2020-11-09 07:34:55 +00:00
|
|
|
BUILD_COMMAND ${make_cmd} fio EXTFLAGS=-Wno-format-truncation ${FIO_EXTLIBS}
|
2018-02-21 12:03:23 +00:00
|
|
|
INSTALL_COMMAND cp <BINARY_DIR>/fio ${CMAKE_BINARY_DIR}/bin)
|
2020-11-09 07:47:41 +00:00
|
|
|
|
|
|
|
add_library(fio INTERFACE IMPORTED)
|
|
|
|
add_dependencies(fio fio_ext)
|
|
|
|
set_target_properties(fio PROPERTIES
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/src/fio)
|
2018-02-21 12:03:23 +00:00
|
|
|
endfunction()
|