From 68eb5bcdce8d8e2000ec84a53046bd68f2261860 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 9 Nov 2020 13:11:06 +0800 Subject: [PATCH] cmake: use src/liburing for building liburing if it exists so we can build with liburing enabled if the dist tarball contains liburing. Signed-off-by: Kefu Chai --- cmake/modules/Builduring.cmake | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/cmake/modules/Builduring.cmake b/cmake/modules/Builduring.cmake index 38ea2388d0d63..3d28ec82ad2cc 100644 --- a/cmake/modules/Builduring.cmake +++ b/cmake/modules/Builduring.cmake @@ -2,13 +2,21 @@ function(build_uring) include(FindMake) find_make("MAKE_EXECUTABLE" "make_cmd") + if(EXISTS "${PROJECT_SOURCE_DIR}/src/liburing/configure") + set(source_dir_args + SOURCE_DIR "${PROJECT_SOURCE_DIR}/src/liburing") + else() + set(source_dir_args + SOURCE_DIR ${CMAKE_BINARY_DIR}/src/liburing + GIT_REPOSITORY https://git.kernel.dk/liburing + GIT_TAG "liburing-0.7" + GIT_SHALLOW TRUE + UPDATE_DISCONNECTED TRUE) + endif() + include(ExternalProject) ExternalProject_Add(liburing_ext - GIT_REPOSITORY https://git.kernel.dk/liburing - GIT_TAG "liburing-0.7" - GIT_SHALLOW TRUE - UPDATE_DISCONNECTED TRUE - SOURCE_DIR ${CMAKE_BINARY_DIR}/src/liburing + ${source_dir_args} CONFIGURE_COMMAND /configure BUILD_COMMAND env CC=${CMAKE_C_COMPILER} ${make_cmd} -C src -s BUILD_IN_SOURCE 1 -- 2.47.3