From aea83f844f979e5c1324a7e446565258a257669a Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Thu, 11 Jul 2019 19:05:02 +0000 Subject: [PATCH] cmake: add FLAC++ module for audio thumbnailers Signed-off-by: Ivailo Monev --- cmake/modules/CMakeLists.txt | 1 + cmake/modules/FindFLAC++.cmake | 52 ++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 cmake/modules/FindFLAC++.cmake diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt index 576c3311..936abb32 100644 --- a/cmake/modules/CMakeLists.txt +++ b/cmake/modules/CMakeLists.txt @@ -38,6 +38,7 @@ set(cmakeFiles FindEPub.cmake FindExiv2.cmake FindFFmpeg.cmake + FindFLAC++.cmake FindFontconfig.cmake FindGettextPO.cmake FindGLIB2.cmake diff --git a/cmake/modules/FindFLAC++.cmake b/cmake/modules/FindFLAC++.cmake new file mode 100644 index 00000000..b9f7b4eb --- /dev/null +++ b/cmake/modules/FindFLAC++.cmake @@ -0,0 +1,52 @@ +# - Try to find the FLAC++ library +# +# Once done this will define +# +# FLAC_FOUND - system has FLAC++ +# FLAC_INCLUDES - the FLAC++ include directory +# FLAC_LIBRARIES - Link these to use FLAC++ +# FLAC_DEFINITIONS - Compiler switches required for using FLAC++ + +# Copyright (c) 2019, Ivailo Monev, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if(NOT WIN32) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + find_package(PkgConfig) + pkg_check_modules(PC_FLAC QUIET flac++) + set(FLAC_DEFINITIONS ${PC_FLAC_CFLAGS_OTHER}) + set(FLAC_VERSION ${PC_FLAC_VERSION}) +endif() + + +find_path(FLAC_INCLUDES + NAMES + FLAC++/metadata.h + HINTS + ${PC_FLAC_INCLUDEDIR} + ${PC_FLAC_INCLUDESS} +) + +find_library(FLAC_LIBRARIES + NAMES + FLAC++ + HINTS + ${PC_FLAC_LIBDIR} + ${PC_FLAC_LIBRARIES_DIRS} +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(FLAC++ + REQUIRED_VARS FLAC_LIBRARIES FLAC_INCLUDES + VERSION_VAR FLAC_VERSION +) + +if(FLAC_LIBRARIES AND FLAC_INCLUDES) + set(FLAC_FOUND TRUE) +endif() + +mark_as_advanced(FLAC_INCLUDES FLAC_LIBRARIES) +