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] replace custom FindLibuuid.cmake with upstream version #16971

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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)
find_package(LibUUID REQUIRED)
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
92 changes: 92 additions & 0 deletions cmake/modules/FindLibUUID.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

#[=======================================================================[.rst:
FindLibUUID
------------

Find LibUUID include directory and library.

Imported Targets
^^^^^^^^^^^^^^^^

An :ref:`imported target <Imported targets>` named
``LibUUID::LibUUID`` is provided if LibUUID has been found.

Result Variables
^^^^^^^^^^^^^^^^

This module defines the following variables:

``LibUUID_FOUND``
True if LibUUID was found, false otherwise.
``LibUUID_INCLUDE_DIRS``
Include directories needed to include LibUUID headers.
``LibUUID_LIBRARIES``
Libraries needed to link to LibUUID.

Cache Variables
^^^^^^^^^^^^^^^

This module uses the following cache variables:

``LibUUID_LIBRARY``
The location of the LibUUID library file.
``LibUUID_INCLUDE_DIR``
The location of the LibUUID include directory containing ``uuid/uuid.h``.

The cache variables should not be used by project code.
They may be set by end users to point at LibUUID components.
#]=======================================================================]

#-----------------------------------------------------------------------------
if(MSYS)
# Note: on current version of MSYS2, linking to libuuid.dll.a doesn't
# import the right symbols sometimes. Fix this by linking directly
# to the DLL that provides the symbols, instead.
find_library(LibUUID_LIBRARY
NAMES msys-uuid-1.dll
)
elseif(CYGWIN)
# Note: on current version of Cygwin, linking to libuuid.dll.a doesn't
# import the right symbols sometimes. Fix this by linking directly
# to the DLL that provides the symbols, instead.
set(old_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES .dll)
find_library(LibUUID_LIBRARY
NAMES cyguuid-1.dll
)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${old_suffixes})
else()
find_library(LibUUID_LIBRARY
NAMES uuid
)
endif()
mark_as_advanced(LibUUID_LIBRARY)

find_path(LibUUID_INCLUDE_DIR
NAMES uuid/uuid.h
)
mark_as_advanced(LibUUID_INCLUDE_DIR)

#-----------------------------------------------------------------------------
include(${CMAKE_CURRENT_LIST_DIR}/../../Modules/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibUUID
FOUND_VAR LibUUID_FOUND
REQUIRED_VARS LibUUID_LIBRARY LibUUID_INCLUDE_DIR
)
set(LIBUUID_FOUND ${LibUUID_FOUND})

#-----------------------------------------------------------------------------
# Provide documented result variables and targets.
if(LibUUID_FOUND)
set(LibUUID_INCLUDE_DIRS ${LibUUID_INCLUDE_DIR})
set(LibUUID_LIBRARIES ${LibUUID_LIBRARY})
if(NOT TARGET LibUUID::LibUUID)
add_library(LibUUID::LibUUID UNKNOWN IMPORTED)
set_target_properties(LibUUID::LibUUID PROPERTIES
IMPORTED_LOCATION "${LibUUID_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${LibUUID_INCLUDE_DIRS}"
)
endif()
endif()
76 changes: 0 additions & 76 deletions cmake/modules/Findlibuuid.cmake

This file was deleted.

12 changes: 6 additions & 6 deletions cmake/modules/SearchInstalledSoftware.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1119,8 +1119,8 @@ if(davix AND NOT builtin_davix)
else()
find_package(Davix 0.6.4)
if(NOT DAVIX_FOUND)
find_package(libuuid)
if(NOT libuuid_FOUND)
find_package(LibUUID)
if(NOT LibUUID_FOUND)
message(STATUS "Davix dependency libuuid not found, switching OFF 'davix' option.")
endif()
find_package(LibXml2)
Expand All @@ -1131,7 +1131,7 @@ if(davix AND NOT builtin_davix)
if(NOT (OPENSSL_FOUND OR builtin_openssl))
message(STATUS "Davix dependency openssl not found, switching OFF 'davix' option.")
endif()
if(libuuid_FOUND AND LIBXML2_FOUND AND (OPENSSL_FOUND OR builtin_openssl))
if(LibUUID_FOUND AND LIBXML2_FOUND AND (OPENSSL_FOUND OR builtin_openssl))
message(STATUS "Davix not found, switching ON 'builtin_davix' option.")
set(builtin_davix ON CACHE BOOL "Enabled because external Davix not found but davix requested (${builtin_davix_description})" FORCE)
else()
Expand Down Expand Up @@ -1184,10 +1184,10 @@ endif()
if (daos OR daos_mock)
message(STATUS "Looking for libuuid")
if(fail-on-missing)
find_package(libuuid REQUIRED)
find_package(LibUUID REQUIRED)
else()
find_package(libuuid)
if(NOT libuuid_FOUND)
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)
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