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:
committed by
Dominik Schmidt
parent
bcd92ed508
commit
115b3f7521
@@ -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_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)
|
||||
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")
|
||||
find_package(Taglib 1.8.0 REQUIRED)
|
||||
include( CheckTagLibFileName )
|
||||
check_taglib_filename( COMPLEX_TAGLIB_FILENAME )
|
||||
|
||||
|
@@ -1,87 +1,90 @@
|
||||
# - Try to find the Taglib library
|
||||
# Once done this will define
|
||||
#.rst:
|
||||
# FindTaglib
|
||||
# ----------
|
||||
#
|
||||
# TAGLIB_FOUND - system has the taglib library
|
||||
# TAGLIB_CFLAGS - the taglib cflags
|
||||
# TAGLIB_LIBRARIES - The libraries needed to use taglib
|
||||
|
||||
# Copyright (c) 2006, Laurent Montel, <montel@kde.org>
|
||||
# Try to find the Taglib library.
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
# This will define the following variables:
|
||||
#
|
||||
# ``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)
|
||||
MESSAGE(STATUS "Using manually specified taglib locations")
|
||||
ELSE()
|
||||
find_package(PkgConfig QUIET)
|
||||
|
||||
if(NOT TAGLIB_MIN_VERSION)
|
||||
set(TAGLIB_MIN_VERSION "1.6")
|
||||
endif(NOT TAGLIB_MIN_VERSION)
|
||||
pkg_search_module(PC_TAGLIB QUIET taglib)
|
||||
|
||||
if(NOT WIN32)
|
||||
find_program(TAGLIBCONFIG_EXECUTABLE NAMES taglib-config PATHS
|
||||
${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
|
||||
find_path(Taglib_INCLUDE_DIRS
|
||||
NAMES tag.h
|
||||
PATH_SUFFIXES taglib
|
||||
PATHS
|
||||
${INCLUDE_INSTALL_DIR}
|
||||
HINTS ${PC_TAGLIB_INCLUDEDIR}
|
||||
)
|
||||
|
||||
find_library_with_debug(TAGLIB_LIBRARIES
|
||||
WIN32_DEBUG_POSTFIX d
|
||||
find_library(Taglib_LIBRARIES
|
||||
NAMES tag
|
||||
PATHS
|
||||
${LIB_INSTALL_DIR}
|
||||
HINTS ${PC_TAGLIB_LIBDIR}
|
||||
)
|
||||
|
||||
find_package_handle_standard_args(Taglib DEFAULT_MSG
|
||||
TAGLIB_INCLUDES TAGLIB_LIBRARIES)
|
||||
endif(TAGLIBCONFIG_EXECUTABLE)
|
||||
ENDIF()
|
||||
set(Taglib_VERSION ${PC_TAGLIB_VERSION})
|
||||
|
||||
if(TAGLIB_FOUND)
|
||||
if(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE)
|
||||
message(STATUS "Found TagLib: ${TAGLIB_LIBRARIES}")
|
||||
endif(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE)
|
||||
else(TAGLIB_FOUND)
|
||||
if(Taglib_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could not find Taglib")
|
||||
endif(Taglib_FIND_REQUIRED)
|
||||
endif(TAGLIB_FOUND)
|
||||
if (Taglib_INCLUDE_DIRS AND NOT Taglib_VERSION)
|
||||
if(EXISTS "${Taglib_INCLUDE_DIRS}/taglib.h")
|
||||
file(READ "${Taglib_INCLUDE_DIRS}/taglib.h" TAGLIB_H)
|
||||
|
||||
string(REGEX MATCH "#define TAGLIB_MAJOR_VERSION[ ]+[0-9]+" TAGLIB_MAJOR_VERSION_MATCH ${TAGLIB_H})
|
||||
string(REGEX MATCH "#define TAGLIB_MINOR_VERSION[ ]+[0-9]+" TAGLIB_MINOR_VERSION_MATCH ${TAGLIB_H})
|
||||
string(REGEX MATCH "#define TAGLIB_PATCH_VERSION[ ]+[0-9]+" TAGLIB_PATCH_VERSION_MATCH ${TAGLIB_H})
|
||||
|
||||
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"
|
||||
)
|
||||
|
@@ -533,8 +533,7 @@ TARGET_LINK_LIBRARIES(${TOMAHAWK_LIBRARY} PRIVATE
|
||||
)
|
||||
|
||||
# TagLib
|
||||
TARGET_LINK_LIBRARIES(${TOMAHAWK_LIBRARY} LINK_PUBLIC ${TAGLIB_LIBRARIES})
|
||||
TARGET_INCLUDE_DIRECTORIES(${TOMAHAWK_LIBRARY} PUBLIC ${TAGLIB_INCLUDES})
|
||||
target_link_libraries(${TOMAHAWK_LIBRARY} LINK_PUBLIC Taglib::Taglib)
|
||||
|
||||
INSTALL( TARGETS ${TOMAHAWK_LIBRARY}
|
||||
EXPORT TomahawkLibraryDepends
|
||||
|
Reference in New Issue
Block a user