Warning, /frameworks/extra-cmake-modules/find-modules/FindCanberra.cmake is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2012 Raphael Kubo da Costa <rakuco@FreeBSD.org>
0002 # SPDX-FileCopyrightText: 2019 Harald Sitter <sitter@kde.org>
0003 #
0004 # SPDX-License-Identifier: BSD-3-Clause
0005
0006 #[=======================================================================[.rst:
0007 FindCanberra
0008 ------------
0009
0010 Try to find Canberra event sound library.
0011
0012 This will define the following variables:
0013
0014 ``Canberra_FOUND``
0015 True if (the requested version of) Canberra is available
0016 ``Canberra_VERSION``
0017 The version of Canberra
0018 ``Canberra_LIBRARIES``
0019 The libraries of Canberra for use with target_link_libraries()
0020 ``Canberra_INCLUDE_DIRS``
0021 The include dirs of Canberra for use with target_include_directories()
0022
0023 If ``Canberra_FOUND`` is TRUE, it will also define the following imported
0024 target:
0025
0026 ``Canberra::Canberra``
0027 The Canberra library
0028
0029 In general we recommend using the imported target, as it is easier to use.
0030 Bear in mind, however, that if the target is in the link interface of an
0031 exported library, it must be made available by the package config file.
0032
0033 Since 5.56.0.
0034 #]=======================================================================]
0035
0036 find_package(PkgConfig QUIET)
0037 pkg_check_modules(PC_Canberra QUIET IMPORTED_TARGET libcanberra)
0038
0039 find_library(Canberra_LIBRARIES
0040 NAMES canberra
0041 HINTS ${PC_Canberra_LIBRARY_DIRS}
0042 )
0043
0044 find_path(Canberra_INCLUDE_DIRS
0045 NAMES canberra.h
0046 HINTS ${PC_Canberra_INCLUDE_DIRS}
0047 )
0048
0049 set(Canberra_VERSION ${PC_Canberra_VERSION})
0050
0051 include(FindPackageHandleStandardArgs)
0052 find_package_handle_standard_args(Canberra
0053 FOUND_VAR
0054 Canberra_FOUND
0055 REQUIRED_VARS
0056 Canberra_LIBRARIES
0057 Canberra_INCLUDE_DIRS
0058 VERSION_VAR
0059 Canberra_VERSION
0060 )
0061
0062 if(Canberra_FOUND AND NOT TARGET Canberra::Canberra)
0063 add_library(Canberra::Canberra UNKNOWN IMPORTED)
0064 set_target_properties(Canberra::Canberra PROPERTIES
0065 IMPORTED_LOCATION "${Canberra_LIBRARIES}"
0066 INTERFACE_COMPILE_OPTIONS "${PC_Canberra_CFLAGS}"
0067 INTERFACE_INCLUDE_DIRECTORIES "${Canberra_INCLUDE_DIRS}"
0068 )
0069 if (TARGET PkgConfig::PC_Canberra)
0070 target_link_libraries(Canberra::Canberra INTERFACE PkgConfig::PC_Canberra)
0071 endif()
0072 endif()
0073
0074 mark_as_advanced(Canberra_LIBRARIES Canberra_INCLUDE_DIRS Canberra_VERSION)
0075
0076 include(FeatureSummary)
0077 set_package_properties(Canberra PROPERTIES
0078 DESCRIPTION "Event sound library"
0079 URL "https://0pointer.de/lennart/projects/libcanberra"
0080 )
0081
0082 # Compatibility variables. In a previous life FindCanberra lived
0083 # in a number of different repos: don't break them if they use ECM but have not
0084 # been updated for this finder.
0085 set(CANBERRA_FOUND ${Canberra_FOUND})
0086 set(CANBERRA_VERSION ${Canberra_VERSION})
0087 set(CANBERRA_LIBRARIES ${Canberra_LIBRARIES})
0088 set(CANBERRA_INCLUDE_DIRS ${Canberra_INCLUDE_DIRS})
0089 mark_as_advanced(CANBERRA_VERSION CANBERRA_LIBRARIES CANBERRA_INCLUDE_DIRS)