-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMake support for better dependency management #946
Comments
It looks like there is an attempt to intergrate CMake with liburing (#438), but it is more like "make CMake around exists code base" than "make everything around CMake". So..I would like to help with this and would be glad to hear any suggestions |
In general, FetchContent is a very poor solution to dependency management. Build liburing externally or just build it as an ExternalProject or command or something like that and just |
Okay, got it If someone else is looking for a static linking solution with CMake. I solved it this way:
set(LIBURING_LIB_PATH ${CMAKE_CURRENT_LIST_DIR}/liburing.git/src/liburing.a)
if (NOT EXISTS ${LIBURING_LIB_PATH})
message(STATUS "Building liburing")
execute_process(
COMMAND ./configure
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/liburing.git
OUTPUT_QUIET
)
execute_process(
COMMAND make
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/liburing.git
OUTPUT_QUIET
)
endif ()
add_library(${PROJECT_NAME}_liburing STATIC IMPORTED GLOBAL)
set_property(TARGET ${PROJECT_NAME}_liburing PROPERTY
IMPORTED_LOCATION ${LIBURING_LIB_PATH})
target_include_directories(${PROJECT_NAME}_liburing INTERFACE ${CMAKE_CURRENT_LIST_DIR}/liburing.git/src/include) |
bozhe moi git clone liburing.git \
&& cd liburing \
&& ./configure --prefix=/muh/install/path \
&& make && make install Here's the find script:
Then in your cmake toolchain file: list(APPEND CMAKE_PREFIX_PATH "/muh/install/path") and then: find_package(liburing 2.5 REQUIRED) will just work, it's ez pz, man |
In some cases it makes sense to use liburing as static library and when you try to realize this in CMake project without install liburing to your system you have only one way to do this: move it on CMake build step, which forces you to hard-code binary and include dir pathes. To avoid this and get all include and lib pathes from CMake lib target you can use FetchContent, but it requires CMakeLists.txt in dependency :/
The text was updated successfully, but these errors were encountered: