Warning, /graphics/krita/cmake/modules/avcodecs/FindFLAC.cmake is written in an unsupported language. File is not indexed.
0001 # Sourced from libsndfile:
0002 # https://github.com/libsndfile/libsndfile
0003 #
0004 # - Find FLAC
0005 # Find the native FLAC includes and libraries
0006 #
0007 # FLAC_INCLUDE_DIRS - where to find FLAC headers.
0008 # FLAC_LIBRARIES - List of libraries when using libFLAC.
0009 # FLAC_FOUND - True if libFLAC found.
0010 # FLAC_DEFINITIONS - FLAC compile definitons
0011
0012 if (FLAC_INCLUDE_DIR)
0013 # Already in cache, be silent
0014 set (FLAC_FIND_QUIETLY TRUE)
0015 endif ()
0016
0017 find_package (Ogg QUIET)
0018
0019 find_package (PkgConfig QUIET)
0020 pkg_check_modules(PC_FLAC QUIET flac)
0021
0022 set(FLAC_VERSION ${PC_FLAC_VERSION})
0023
0024 find_path (FLAC_INCLUDE_DIR FLAC/stream_decoder.h
0025 HINTS
0026 ${PC_FLAC_INCLUDEDIR}
0027 ${PC_FLAC_INCLUDE_DIRS}
0028 ${FLAC_ROOT}
0029 )
0030
0031 # MSVC built libraries can name them *_static, which is good as it
0032 # distinguishes import libraries from static libraries with the same extension.
0033 find_library (FLAC_LIBRARY
0034 NAMES
0035 FLAC
0036 libFLAC
0037 libFLAC_dynamic
0038 libFLAC_static
0039 HINTS
0040 ${PC_FLAC_LIBDIR}
0041 ${PC_FLAC_LIBRARY_DIRS}
0042 ${FLAC_ROOT}
0043 )
0044
0045 # Handle the QUIETLY and REQUIRED arguments and set FLAC_FOUND to TRUE if
0046 # all listed variables are TRUE.
0047 include (FindPackageHandleStandardArgs)
0048 find_package_handle_standard_args (FLAC
0049 REQUIRED_VARS
0050 FLAC_LIBRARY
0051 FLAC_INCLUDE_DIR
0052 Ogg_FOUND
0053 VERSION_VAR
0054 FLAC_VERSION
0055 )
0056
0057 if (FLAC_FOUND)
0058 set (FLAC_INCLUDE_DIRS ${FLAC_INCLUDE_DIR})
0059 set (FLAC_LIBRARIES ${FLAC_LIBRARY} ${OGG_LIBRARIES})
0060 if (NOT TARGET FLAC::FLAC)
0061 add_library(FLAC::FLAC UNKNOWN IMPORTED)
0062 set_target_properties(FLAC::FLAC PROPERTIES
0063 INTERFACE_INCLUDE_DIRECTORIES "${FLAC_INCLUDE_DIR}"
0064 IMPORTED_LOCATION "${FLAC_LIBRARY}"
0065 INTERFACE_LINK_LIBRARIES Ogg::ogg
0066 )
0067 endif ()
0068 endif ()
0069
0070 mark_as_advanced(FLAC_INCLUDE_DIR FLAC_LIBRARY)