1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-29 23:29:41 +02:00
audacity/cmake-modules/FindFLAC.cmake
Be b1549dd13e
CMake: replace Conan with find_package and add find modules
Also, necessarily coupled with this:
* add CMakeLists.txt for vendored libnyquist
* fix SoundTouch header include paths
* move nyq_reformat_aud_do_response function
* handle portSMF headers installed to portsmf or portSMF

Signed-off-by: Be <be@mixxx.org>
2021-08-16 13:22:01 -05:00

86 lines
2.0 KiB
CMake

# Copyright (C) 2001-2020 Mixxx Development Team
# Distributed under the GNU General Public Licence (GPL) version 2 or any later
# later version. See the LICENSE file for details.
#[=======================================================================[.rst:
FindFLAC
--------
Finds the FLAC library.
Imported Targets
^^^^^^^^^^^^^^^^
This module provides the following imported targets, if found:
``FLAC::FLAC``
The FLAC library
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables:
``FLAC_FOUND``
True if the system has the FLAC library.
``FLAC_INCLUDE_DIRS``
Include directories needed to use FLAC.
``FLAC_LIBRARIES``
Libraries needed to link to FLAC.
``FLAC_DEFINITIONS``
Compile definitions needed to use FLAC.
Cache Variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``FLAC_INCLUDE_DIR``
The directory containing ``FLAC/all.h``.
``FLAC_LIBRARY``
The path to the FLAC library.
#]=======================================================================]
find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
pkg_check_modules(PC_FLAC QUIET flac)
endif()
find_path(FLAC_INCLUDE_DIR
NAMES FLAC/all.h
PATHS ${PC_FLAC_INCLUDE_DIRS}
DOC "FLAC include directory")
mark_as_advanced(FLAC_INCLUDE_DIR)
find_library(FLAC_LIBRARY
NAMES FLAC
PATHS ${PC_FLAC_LIBRARY_DIRS}
DOC "FLAC library"
)
mark_as_advanced(FLAC_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
FLAC
DEFAULT_MSG
FLAC_LIBRARY
FLAC_INCLUDE_DIR
)
if(FLAC_FOUND)
set(FLAC_LIBRARIES "${FLAC_LIBRARY}")
set(FLAC_INCLUDE_DIRS "${FLAC_INCLUDE_DIR}")
set(FLAC_DEFINITIONS ${PC_FLAC_CFLAGS_OTHER})
if(NOT TARGET FLAC::FLAC)
add_library(FLAC::FLAC UNKNOWN IMPORTED)
set_target_properties(FLAC::FLAC
PROPERTIES
IMPORTED_LOCATION "${FLAC_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${PC_FLAC_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${FLAC_INCLUDE_DIR}"
)
endif()
endif()