Warning, /multimedia/audiocd-kio/cmake/FindFLAC.cmake is written in an unsupported language. File is not indexed.

0001 # - Find FLAC
0002 # Find the native FLAC includes and libraries
0003 #
0004 #  FLAC_INCLUDE_DIR - where to find FLAC headers.
0005 #  FLAC_LIBRARIES   - List of libraries when using libFLAC.
0006 #  FLAC_FOUND       - True if libFLAC found.
0007 
0008 if(FLAC_INCLUDE_DIR)
0009     # Already in cache, be silent
0010     set(FLAC_FIND_QUIETLY TRUE)
0011 endif()
0012 
0013 find_path(FLAC_INCLUDE_DIR FLAC/stream_decoder.h)
0014 
0015 # MSVC built libraries can name them *_static, which is good as it
0016 # distinguishes import libraries from static libraries with the same extension.
0017 find_library(FLAC_LIBRARY NAMES FLAC libFLAC libFLAC_dynamic libFLAC_static)
0018 find_library(OGG_LIBRARY NAMES ogg ogg_static libogg libogg_static)
0019 
0020 # Handle the QUIETLY and REQUIRED arguments and set FLAC_FOUND to TRUE if
0021 # all listed variables are TRUE.
0022 include(FindPackageHandleStandardArgs)
0023 find_package_handle_standard_args(FLAC
0024     DEFAULT_MSG
0025     FLAC_INCLUDE_DIR OGG_LIBRARY FLAC_LIBRARY
0026 )
0027 
0028 if(FLAC_FOUND)
0029     set(FLAC_LIBRARIES ${FLAC_LIBRARY} ${OGG_LIBRARY})
0030     if(WIN32)
0031         set(FLAC_LIBRARIES ${FLAC_LIBRARIES} wsock32)
0032     endif()
0033 else()
0034     set(FLAC_LIBRARIES)
0035 endif()
0036 
0037 mark_as_advanced(
0038     FLAC_INCLUDE_DIR
0039     FLAC_LIBRARY
0040 )
0041 
0042 if(FLAC_FOUND AND NOT TARGET FLAC::FLAC)
0043     add_library(FLAC::FLAC UNKNOWN IMPORTED)
0044     set_target_properties(FLAC::FLAC PROPERTIES
0045         IMPORTED_LOCATION "${FLAC_LIBRARY}"
0046         INTERFACE_INCLUDE_DIRECTORIES "${FLAC_INCLUDE_DIR}"
0047     )
0048     if(WIN32)
0049         set_target_properties(FLAC::FLAC PROPERTIES
0050             INTERFACE_LINK_LIBRARIES  "${OGG_LIBRARY};wsock32"
0051         )
0052     else()
0053         set_target_properties(FLAC::FLAC PROPERTIES
0054             INTERFACE_LINK_LIBRARIES  "${OGG_LIBRARY}"
0055         )
0056     endif()
0057 endif()