1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-13 17:43:59 +02:00

Import FindTaglib.cmake from ECM 5.72.0 and mark Taglib as REQUIRED

This version of ECM gained a module that is overriding Tomahawk's own, but
variables are incompatible. Use the updated ECM module until we can depend
on the necessary ECM version itself.

Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
This commit is contained in:
Andreas Sturmlechner
2020-07-13 02:11:06 +02:00
committed by Dominik Schmidt
parent bcd92ed508
commit 115b3f7521
3 changed files with 77 additions and 76 deletions

View File

@@ -212,8 +212,7 @@ macro_log_feature(Boost_FOUND "Boost" "Provides free peer-reviewed portable C++
macro_optional_find_package(Lucene++ 3.0.0) macro_optional_find_package(Lucene++ 3.0.0)
macro_log_feature(LUCENEPP_FOUND "Lucene++" "The open-source, C++ search engine" "https://github.com/luceneplusplus/LucenePlusPlus/" TRUE "" "Lucene++ is used for indexing the collection") macro_log_feature(LUCENEPP_FOUND "Lucene++" "The open-source, C++ search engine" "https://github.com/luceneplusplus/LucenePlusPlus/" TRUE "" "Lucene++ is used for indexing the collection")
macro_optional_find_package(Taglib 1.8.0) find_package(Taglib 1.8.0 REQUIRED)
macro_log_feature(TAGLIB_FOUND "TagLib" "Audio Meta-Data Library" "http://developer.kde.org/~wheeler/taglib.html" TRUE "" "taglib is needed for reading meta data from audio files")
include( CheckTagLibFileName ) include( CheckTagLibFileName )
check_taglib_filename( COMPLEX_TAGLIB_FILENAME ) check_taglib_filename( COMPLEX_TAGLIB_FILENAME )

View File

@@ -1,87 +1,90 @@
# - Try to find the Taglib library #.rst:
# Once done this will define # FindTaglib
# ----------
# #
# TAGLIB_FOUND - system has the taglib library # Try to find the Taglib library.
# TAGLIB_CFLAGS - the taglib cflags
# TAGLIB_LIBRARIES - The libraries needed to use taglib
# Copyright (c) 2006, Laurent Montel, <montel@kde.org>
# #
# Redistribution and use is allowed according to the terms of the BSD license. # This will define the following variables:
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. #
# ``Taglib_FOUND``
# True if the system has the taglib library of at least the minimum
# version specified by the version parameter to find_package()
# ``Taglib_INCLUDE_DIRS``
# The taglib include dirs for use with target_include_directories
# ``Taglib_LIBRARIES``
# The taglib libraries for use with target_link_libraries()
# ``Taglib_VERSION``
# The version of taglib that was found
#
# If ``Taglib_FOUND`` is TRUE, it will also define the following imported
# target:
#
# ``Taglib::Taglib``
# The Taglib library
#
# Since 5.72.0
#
# SPDX-FileCopyrightText: 2006 Laurent Montel <montel@kde.org>
# SPDX-FileCopyrightText: 2019 Heiko Becker <heirecka@exherbo.org>
# SPDX-FileCopyrightText: 2020 Elvis Angelaccio <elvis.angelaccio@kde.org>
# SPDX-License-Identifier: BSD-3-Clause
IF(TAGLIB_FOUND) find_package(PkgConfig QUIET)
MESSAGE(STATUS "Using manually specified taglib locations")
ELSE()
if(NOT TAGLIB_MIN_VERSION) pkg_search_module(PC_TAGLIB QUIET taglib)
set(TAGLIB_MIN_VERSION "1.6")
endif(NOT TAGLIB_MIN_VERSION)
if(NOT WIN32) find_path(Taglib_INCLUDE_DIRS
find_program(TAGLIBCONFIG_EXECUTABLE NAMES taglib-config PATHS NAMES tag.h
${BIN_INSTALL_DIR}
)
endif(NOT WIN32)
#reset vars
set(TAGLIB_LIBRARIES)
set(TAGLIB_CFLAGS)
# MESSAGE( STATUS "PATHS: ${PATHS}")
# if taglib-config has been found
if(TAGLIBCONFIG_EXECUTABLE)
exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_VERSION)
if(TAGLIB_VERSION VERSION_LESS "${TAGLIB_MIN_VERSION}")
message(STATUS "TagLib version not found: version searched :${TAGLIB_MIN_VERSION}, found ${TAGLIB_VERSION}")
set(TAGLIB_FOUND FALSE)
else(TAGLIB_VERSION VERSION_LESS "${TAGLIB_MIN_VERSION}")
exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_LIBRARIES)
exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_CFLAGS)
if(TAGLIB_LIBRARIES AND TAGLIB_CFLAGS)
set(TAGLIB_FOUND TRUE)
# message(STATUS "Found taglib: ${TAGLIB_LIBRARIES}")
endif(TAGLIB_LIBRARIES AND TAGLIB_CFLAGS)
string(REGEX REPLACE " *-I" ";" TAGLIB_INCLUDES "${TAGLIB_CFLAGS}")
endif(TAGLIB_VERSION VERSION_LESS "${TAGLIB_MIN_VERSION}")
mark_as_advanced(TAGLIB_CFLAGS TAGLIB_LIBRARIES TAGLIB_INCLUDES)
else(TAGLIBCONFIG_EXECUTABLE)
include(FindLibraryWithDebug)
include(FindPackageHandleStandardArgs)
find_path(TAGLIB_INCLUDES
NAMES
tag.h
PATH_SUFFIXES taglib PATH_SUFFIXES taglib
PATHS HINTS ${PC_TAGLIB_INCLUDEDIR}
${INCLUDE_INSTALL_DIR}
) )
find_library_with_debug(TAGLIB_LIBRARIES find_library(Taglib_LIBRARIES
WIN32_DEBUG_POSTFIX d
NAMES tag NAMES tag
PATHS HINTS ${PC_TAGLIB_LIBDIR}
${LIB_INSTALL_DIR}
) )
find_package_handle_standard_args(Taglib DEFAULT_MSG set(Taglib_VERSION ${PC_TAGLIB_VERSION})
TAGLIB_INCLUDES TAGLIB_LIBRARIES)
endif(TAGLIBCONFIG_EXECUTABLE)
ENDIF()
if(TAGLIB_FOUND) if (Taglib_INCLUDE_DIRS AND NOT Taglib_VERSION)
if(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE) if(EXISTS "${Taglib_INCLUDE_DIRS}/taglib.h")
message(STATUS "Found TagLib: ${TAGLIB_LIBRARIES}") file(READ "${Taglib_INCLUDE_DIRS}/taglib.h" TAGLIB_H)
endif(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE)
else(TAGLIB_FOUND) string(REGEX MATCH "#define TAGLIB_MAJOR_VERSION[ ]+[0-9]+" TAGLIB_MAJOR_VERSION_MATCH ${TAGLIB_H})
if(Taglib_FIND_REQUIRED) string(REGEX MATCH "#define TAGLIB_MINOR_VERSION[ ]+[0-9]+" TAGLIB_MINOR_VERSION_MATCH ${TAGLIB_H})
message(FATAL_ERROR "Could not find Taglib") string(REGEX MATCH "#define TAGLIB_PATCH_VERSION[ ]+[0-9]+" TAGLIB_PATCH_VERSION_MATCH ${TAGLIB_H})
endif(Taglib_FIND_REQUIRED)
endif(TAGLIB_FOUND) string(REGEX REPLACE ".*_MAJOR_VERSION[ ]+(.*)" "\\1" TAGLIB_MAJOR_VERSION "${TAGLIB_MAJOR_VERSION_MATCH}")
string(REGEX REPLACE ".*_MINOR_VERSION[ ]+(.*)" "\\1" TAGLIB_MINOR_VERSION "${TAGLIB_MINOR_VERSION_MATCH}")
string(REGEX REPLACE ".*_PATCH_VERSION[ ]+(.*)" "\\1" TAGLIB_PATCH_VERSION "${TAGLIB_PATCH_VERSION_MATCH}")
set(Taglib_VERSION "${TAGLIB_MAJOR_VERSION}.${TAGLIB_MINOR_VERSION}.${TAGLIB_PATCH_VERSION}")
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Taglib
FOUND_VAR
Taglib_FOUND
REQUIRED_VARS
Taglib_LIBRARIES
Taglib_INCLUDE_DIRS
VERSION_VAR
Taglib_VERSION
)
if (Taglib_FOUND AND NOT TARGET Taglib::Taglib)
add_library(Taglib::Taglib UNKNOWN IMPORTED)
set_target_properties(Taglib::Taglib PROPERTIES
IMPORTED_LOCATION "${Taglib_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${Taglib_INCLUDE_DIRS}"
)
endif()
mark_as_advanced(Taglib_LIBRARIES Taglib_INCLUDE_DIRS)
include(FeatureSummary)
set_package_properties(Taglib PROPERTIES
URL "https://taglib.org/"
DESCRIPTION "A library for reading and editing the meta-data of audio formats"
)

View File

@@ -533,8 +533,7 @@ TARGET_LINK_LIBRARIES(${TOMAHAWK_LIBRARY} PRIVATE
) )
# TagLib # TagLib
TARGET_LINK_LIBRARIES(${TOMAHAWK_LIBRARY} LINK_PUBLIC ${TAGLIB_LIBRARIES}) target_link_libraries(${TOMAHAWK_LIBRARY} LINK_PUBLIC Taglib::Taglib)
TARGET_INCLUDE_DIRECTORIES(${TOMAHAWK_LIBRARY} PUBLIC ${TAGLIB_INCLUDES})
INSTALL( TARGETS ${TOMAHAWK_LIBRARY} INSTALL( TARGETS ${TOMAHAWK_LIBRARY}
EXPORT TomahawkLibraryDepends EXPORT TomahawkLibraryDepends