1 # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 # file Copyright.txt or https://cmake.org/licensing for details.
4 #[=======================================================================[.rst:
8 Find LibUUID include directory and library.
13 An :ref:`imported target <Imported targets>` named
14 ``LibUUID::LibUUID`` is provided if LibUUID has been found.
19 This module defines the following variables:
22 True if LibUUID was found, false otherwise.
23 ``LibUUID_INCLUDE_DIRS``
24 Include directories needed to include LibUUID headers.
26 Libraries needed to link to LibUUID.
31 This module uses the following cache variables:
34 The location of the LibUUID library file.
35 ``LibUUID_INCLUDE_DIR``
36 The location of the LibUUID include directory containing ``uuid/uuid.h``.
38 The cache variables should not be used by project code.
39 They may be set by end users to point at LibUUID components.
40 #]=======================================================================]
42 #-----------------------------------------------------------------------------
44 # Note: on current version of MSYS2, linking to libuuid.dll.a doesn't
45 # import the right symbols sometimes. Fix this by linking directly
46 # to the DLL that provides the symbols, instead.
47 find_library(LibUUID_LIBRARY
51 # Note: on current version of Cygwin, linking to libuuid.dll.a doesn't
52 # import the right symbols sometimes. Fix this by linking directly
53 # to the DLL that provides the symbols, instead.
54 set(old_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
55 set(CMAKE_FIND_LIBRARY_SUFFIXES .dll)
56 find_library(LibUUID_LIBRARY
59 set(CMAKE_FIND_LIBRARY_SUFFIXES ${old_suffixes})
61 find_library(LibUUID_LIBRARY
65 mark_as_advanced(LibUUID_LIBRARY)
67 find_path(LibUUID_INCLUDE_DIR
70 mark_as_advanced(LibUUID_INCLUDE_DIR)
72 #-----------------------------------------------------------------------------
73 include(${CMAKE_CURRENT_LIST_DIR}/../../Modules/FindPackageHandleStandardArgs.cmake)
74 FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibUUID
75 FOUND_VAR LibUUID_FOUND
76 REQUIRED_VARS LibUUID_LIBRARY LibUUID_INCLUDE_DIR
78 set(LIBUUID_FOUND ${LibUUID_FOUND})
80 #-----------------------------------------------------------------------------
81 # Provide documented result variables and targets.
83 set(LibUUID_INCLUDE_DIRS ${LibUUID_INCLUDE_DIR})
84 set(LibUUID_LIBRARIES ${LibUUID_LIBRARY})
85 if(NOT TARGET LibUUID::LibUUID)
86 add_library(LibUUID::LibUUID UNKNOWN IMPORTED)
87 set_target_properties(LibUUID::LibUUID PROPERTIES
88 IMPORTED_LOCATION "${LibUUID_LIBRARY}"
89 INTERFACE_INCLUDE_DIRECTORIES "${LibUUID_INCLUDE_DIRS}"