Skip to content
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] use the vendor-provided pkgconfig for libuuid #16957

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions builtins/davix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

include(ExternalProject)

find_package(libuuid REQUIRED)
search_for_libuuid()
find_package(LibXml2 REQUIRED)
find_package(OpenSSL REQUIRED)

Expand All @@ -27,7 +27,7 @@ ExternalProject_Add(DAVIX
CMAKE_CACHE_ARGS
-DCMAKE_PREFIX_PATH:STRING=${OPENSSL_PREFIX}
-DUUID_INCLUDE_DIR:STRING=${UUID_INCLUDE_DIR}
-DUUID_LIBRARY:STRING=${UUID_LIBRARY}
-DUUID_LIBRARY:STRING=${libuuid_LIBRARIES}
-DLIBXML2_INCLUDE_DIR:PATH=${LIBXML2_INCLUDE_DIR}
-DLIBXML2_INCLUDE_DIRS:STRING=${LIBXML2_INCLUDE_DIRS}
-DLIBXML2_LIBRARY:PATH=${LIBXML2_LIBRARY}
Expand Down
22 changes: 22 additions & 0 deletions cmake/modules/RootMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2062,3 +2062,25 @@ function(generateManual name input output)

install(FILES ${output} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
endfunction()

# ---------------------------------------------------------------------------------------
# search_for_libuuid
#
# Tries looking for libuuid with PkgConfig, fallback to our custom Findlibuuid.cmake
# ---------------------------------------------------------------------------------------
function(search_for_libuuid)
if(fail-on-missing)
set(libuuid_REQUIRED REQUIRED)
endif()

find_package(PkgConfig)
if(PkgConfig_FOUND)
message(STATUS "Looking for libuuid using pkg-config")
pkg_check_modules(libuuid ${libuuid_REQUIRED} uuid)
else()
message(STATUS "Looking for libuuid")
find_package(libuuid ${libuuid_REQUIRED} uuid)
set(libuuid_LIBRARIES ${UUID_LIBRARIES})
endif()
endfunction()

18 changes: 7 additions & 11 deletions cmake/modules/SearchInstalledSoftware.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ if(davix AND NOT builtin_davix)
else()
find_package(Davix 0.6.4)
if(NOT DAVIX_FOUND)
find_package(libuuid)
search_for_libuuid()
if(NOT libuuid_FOUND)
message(STATUS "Davix dependency libuuid not found, switching OFF 'davix' option.")
endif()
Expand Down Expand Up @@ -1182,18 +1182,14 @@ if (testing AND NOT daos AND NOT WIN32)
endif()

if (daos OR daos_mock)
message(STATUS "Looking for libuuid")
if(fail-on-missing)
find_package(libuuid REQUIRED)
else()
find_package(libuuid)
if(NOT libuuid_FOUND)
message(STATUS "libuuid not found. Disabling DAOS support")
set(daos OFF CACHE BOOL "Disabled (libuuid not found)" FORCE)
set(daos_mock OFF CACHE BOOL "Disabled (libuuid not found)" FORCE)
endif()
search_for_libuuid()
if(NOT libuuid_FOUND)
message(STATUS "libuuid not found. Disabling DAOS support")
set(daos OFF CACHE BOOL "Disabled (libuuid not found)" FORCE)
set(daos_mock OFF CACHE BOOL "Disabled (libuuid not found)" FORCE)
endif()
endif()

if (daos)
message(STATUS "Looking for DAOS")
if(fail-on-missing)
Expand Down
2 changes: 1 addition & 1 deletion tree/ntuple/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ if(daos OR daos_mock)
target_compile_definitions(ROOTNTuple PRIVATE R__ENABLE_DAOS)

target_include_directories(ROOTNTuple PRIVATE ${UUID_INCLUDE_DIR})
target_link_libraries(ROOTNTuple PRIVATE ${UUID_LIBRARY})
target_link_libraries(ROOTNTuple PRIVATE ${libuuid_LIBRARIES})
if(daos_mock)
target_include_directories(ROOTNTuple PRIVATE v7/inc/ROOT/libdaos_mock/)
target_sources(ROOTNTuple PRIVATE v7/src/libdaos_mock/libdaos_mock.cxx)
Expand Down
Loading