Warning, /education/minuet/cmake/FindFluidSynth.cmake is written in an unsupported language. File is not indexed.
0001 #.rst:
0002 # FindFluidSynth
0003 # ---------
0004 #
0005 # Try to find the FluidSynth library.
0006 #
0007 # This will define the following variables:
0008 #
0009 # ``FluidSynth_FOUND``
0010 # System has FluidSynth.
0011 #
0012 # ``FluidSynth_VERSION``
0013 # The version of FluidSynth.
0014 #
0015 # ``FluidSynth_INCLUDE_DIRS``
0016 # This should be passed to target_include_directories() if
0017 # the target is not used for linking.
0018 #
0019 # ``FluidSynth_LIBRARIES``
0020 # The FluidSynth library.
0021 # This can be passed to target_link_libraries() instead of
0022 # the ``FluidSynth::FluidSynth`` target
0023 #
0024 # If ``FluidSynth_FOUND`` is TRUE, the following imported target
0025 # will be available:
0026 #
0027 # ``FluidSynth::FluidSynth``
0028 # The FluidSynth library
0029 #
0030 #=============================================================================
0031 # Copyright 2018 Christophe Giboudeaux <christophe@krop.fr>
0032 #
0033 #
0034 # Redistribution and use in source and binary forms, with or without
0035 # modification, are permitted provided that the following conditions
0036 # are met:
0037 #
0038 # 1. Redistributions of source code must retain the copyright
0039 # notice, this list of conditions and the following disclaimer.
0040 # 2. Redistributions in binary form must reproduce the copyright
0041 # notice, this list of conditions and the following disclaimer in the
0042 # documentation and/or other materials provided with the distribution.
0043 # 3. The name of the author may not be used to endorse or promote products
0044 # derived from this software without specific prior written permission.
0045 #
0046 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
0047 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
0048 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
0049 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
0050 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
0051 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0052 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0053 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0054 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
0055 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0056 #=============================================================================
0057
0058 if(NOT ${FluidSynth_FIND_VERSION})
0059 set(FluidSynth_FIND_VERSION "1.1.6")
0060 endif()
0061
0062 find_package(PkgConfig QUIET)
0063 pkg_check_modules(PC_FluidSynth QUIET fluidsynth>=${FluidSynth_FIND_VERSION})
0064
0065 # The Windows library may be called fluidsynth_debug
0066 find_library(FluidSynth_LIBRARIES
0067 NAMES fluidsynth fluidsynth_debug
0068 HINTS ${PC_FluidSynth_LIBDIR}
0069 )
0070
0071 find_path(FluidSynth_INCLUDE_DIRS
0072 NAMES fluidsynth.h
0073 HINTS ${PC_FluidSynth_INCLUDEDIR}
0074 )
0075
0076 set(FluidSynth_VERSION "${PC_FluidSynth_VERSION}")
0077
0078 if(NOT FluidSynth_VERSION)
0079 if(EXISTS "${FluidSynth_INCLUDE_DIRS}/fluidsynth/version.h")
0080 file(STRINGS "${FluidSynth_INCLUDE_DIRS}/fluidsynth/version.h" _FLUIDSYNTH_VERSION_H
0081 REGEX "^#define[ ]+FLUIDSYNTH_VERSION.*$")
0082 string(REGEX REPLACE "^#define[ ]+FLUIDSYNTH_VERSION[ ]+\"([0-9]+.[0-9]+.[0-9]+)\".*" "\\1" FluidSynth_VERSION "${_FLUIDSYNTH_VERSION_H}")
0083 unset(_FLUIDSYNTH_VERSION_H)
0084 endif()
0085 endif()
0086
0087 include(FindPackageHandleStandardArgs)
0088 find_package_handle_standard_args(FluidSynth
0089 FOUND_VAR FluidSynth_FOUND
0090 REQUIRED_VARS FluidSynth_LIBRARIES FluidSynth_INCLUDE_DIRS
0091 VERSION_VAR FluidSynth_VERSION
0092 )
0093
0094 if(FluidSynth_FOUND AND NOT TARGET FluidSynth::FluidSynth)
0095 add_library(FluidSynth::FluidSynth UNKNOWN IMPORTED)
0096 set_target_properties(FluidSynth::FluidSynth PROPERTIES
0097 IMPORTED_LOCATION "${FluidSynth_LIBRARIES}"
0098 INTERFACE_INCLUDE_DIRECTORIES "${FluidSynth_INCLUDE_DIRS}"
0099 )
0100 endif()
0101
0102 include(FeatureSummary)
0103 set_package_properties(FluidSynth PROPERTIES
0104 URL "http://www.fluidsynth.org/"
0105 DESCRIPTION "A SoundFont Synthesizer"
0106 )