diff --git a/cmake/FindLibUUID.cmake b/cmake/FindLibUUID.cmake index ab564b7..7c2ad79 100644 --- a/cmake/FindLibUUID.cmake +++ b/cmake/FindLibUUID.cmake @@ -1,51 +1,77 @@ -# - Try to find LIBUUID -# Find LIBUUID headers, libraries and the answer to all questions. +# CMake - Cross Platform Makefile Generator +# Copyright 2000-2024 Kitware, Inc. and Contributors +# All rights reserved. # -# LIBUUID_FOUND True if libuuid got found -# LIBUUID_INCLUDE_DIRS Location of libuuid headers -# LIBUUID_LIBRARIES List of libraries to use libuuid -# -# Copyright (c) 2008 Bjoern Ricks -# -# Redistribution and use is allowed according to the terms of the New -# BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# Distributed under the OSI-approved BSD 3-Clause License. See +# https://cmake.org/licensing for details. # +#[=======================================================================[.rst: +FindLibUUID +------------ -INCLUDE( FindPkgConfig ) +Find LibUUID include directory and library. -IF ( LibUuid_FIND_REQUIRED ) - SET( _pkgconfig_REQUIRED "REQUIRED" ) -ELSE( LibUuid_FIND_REQUIRED ) - SET( _pkgconfig_REQUIRED "" ) -ENDIF ( LibUuid_FIND_REQUIRED ) +Imported Targets +^^^^^^^^^^^^^^^^ -IF ( LIBUUID_MIN_VERSION ) - PKG_SEARCH_MODULE( LIBUUID ${_pkgconfig_REQUIRED} uuid>=${LIBUUID_MIN_VERSION} ) -ELSE ( LIBUUID_MIN_VERSION ) - PKG_SEARCH_MODULE( LIBUUID ${_pkgconfig_REQUIRED} uuid ) -ENDIF ( LIBUUID_MIN_VERSION ) +An :ref:`imported target ` named +``LibUUID::LibUUID`` is provided if LibUUID has been found. +Result Variables +^^^^^^^^^^^^^^^^ -IF( NOT LIBUUID_FOUND AND NOT PKG_CONFIG_FOUND ) - FIND_PATH( LIBUUID_INCLUDE_DIRS uuid/uuid.h ) - FIND_LIBRARY( LIBUUID_LIBRARIES uuid) +This module defines the following variables: - # Report results - IF ( LIBUUID_LIBRARIES AND LIBUUID_INCLUDE_DIRS ) - SET( LIBUUID_FOUND 1 ) - IF ( NOT LIBUUID_FIND_QUIETLY ) - MESSAGE( STATUS "Found libuuid: ${LIBUUID_LIBRARIES}" ) - ENDIF ( NOT LIBUUID_FIND_QUIETLY ) - ELSE ( LIBUUID_LIBRARIES AND LIBUUID_INCLUDE_DIRS ) - IF ( LIBUUID_FIND_REQUIRED ) - MESSAGE( SEND_ERROR "Could NOT find libuuid" ) - ELSE ( LIBUUID_FIND_REQUIRED ) - IF ( NOT LIBUUID_FIND_QUIETLY ) - MESSAGE( STATUS "Could NOT find libuuid" ) - ENDIF ( NOT LIBUUID_FIND_QUIETLY ) - ENDIF ( LIBUUID_FIND_REQUIRED ) - ENDIF ( LIBUUID_LIBRARIES AND LIBUUID_INCLUDE_DIRS ) -ENDIF( NOT LIBUUID_FOUND AND NOT PKG_CONFIG_FOUND ) +``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. -MARK_AS_ADVANCED( LIBUUID_LIBRARIES LIBUUID_INCLUDE_DIRS ) +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. +#]=======================================================================] + +#----------------------------------------------------------------------------- +find_library(LibUUID_LIBRARY + NAMES uuid + ) +mark_as_advanced(LibUUID_LIBRARY) + +find_path(LibUUID_INCLUDE_DIR + NAMES uuid/uuid.h + ) +mark_as_advanced(LibUUID_INCLUDE_DIR) + +#----------------------------------------------------------------------------- +include(FindPackageHandleStandardArgs) +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() diff --git a/libgamestream/CMakeLists.txt b/libgamestream/CMakeLists.txt index 72776f1..3b026de 100644 --- a/libgamestream/CMakeLists.txt +++ b/libgamestream/CMakeLists.txt @@ -23,9 +23,9 @@ target_link_libraries(gamestream moonlight-common) set_target_properties(gamestream PROPERTIES SOVERSION ${SO_VERSION} VERSION ${PROJECT_VERSION}) set_target_properties(moonlight-common PROPERTIES SOVERSION ${SO_VERSION} VERSION ${PROJECT_VERSION}) -target_include_directories(gamestream PRIVATE ../third_party/moonlight-common-c/src ../third_party/h264bitstream ${AVAHI_INCLUDE_DIRS} ${LIBUUID_INCLUDE_DIRS}) +target_include_directories(gamestream PRIVATE ../third_party/moonlight-common-c/src ../third_party/h264bitstream ${AVAHI_INCLUDE_DIRS} ${LibUUID_INCLUDE_DIRS}) target_include_directories(moonlight-common PRIVATE ../third_party/moonlight-common-c/reedsolomon ../third_party/moonlight-common-c/enet/include) -target_link_libraries(gamestream ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES} ${EXPAT_LIBRARIES} ${AVAHI_LIBRARIES} ${LIBUUID_LIBRARIES}) +target_link_libraries(gamestream ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES} ${EXPAT_LIBRARIES} ${AVAHI_LIBRARIES} ${LibUUID_LIBRARIES}) target_link_libraries(gamestream ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})