diff --git a/docs/find-module/FindCanberra.rst b/docs/find-module/FindCanberra.rst new file mode 100644 --- /dev/null +++ b/docs/find-module/FindCanberra.rst @@ -0,0 +1 @@ +.. ecm-module:: ../../find-modules/FindCanberra.cmake diff --git a/find-modules/FindCanberra.cmake b/find-modules/FindCanberra.cmake new file mode 100644 --- /dev/null +++ b/find-modules/FindCanberra.cmake @@ -0,0 +1,69 @@ +#.rst: +# FindCanberra +# ------- +# +# Try to find Canberra event sound library. +# +# This will define the following variables: +# +# ``CANBERRA_FOUND`` +# True if (the requested version of) Canberra is available +# ``CANBERRA_VERSION`` +# The version of Canberra +# ``CANBERRA_LIBRARIES`` +# The libraries of Canberra for use with target_link_libraries() +# ``CANBERRA_INCLUDE_DIRS`` +# The include dirs of Canberra for use with target_include_directories() +# +# Since 5.56.0. + +#============================================================================= +# Copyright (c) 2012 Raphael Kubo da Costa +# Copyright (c) 2019 Harald Sitter +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +find_package(PkgConfig) +pkg_check_modules(PC_CANBERRA libcanberra) + +find_library(CANBERRA_LIBRARIES + NAMES canberra + HINTS ${PC_CANBERRA_LIBRARY_DIRS} ${PC_CANBERRA_LIBDIR} +) + +find_path(CANBERRA_INCLUDE_DIRS + NAMES canberra.h + HINTS ${PC_CANBERRA_INCLUDE_DIRS} ${PC_CANBERRA_INCLUDEDIR} +) + +set(CANBERRA_VERSION ${PC_CANBERRA_VERSION}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Canberra + REQUIRED_VARS CANBERRA_LIBRARIES CANBERRA_INCLUDE_DIRS + VERSION_VAR CANBERRA_VERSION +) + +mark_as_advanced(CANBERRA_LIBRARIES CANBERRA_INCLUDE_DIRS CANBERRA_VERSION)