Commit 81e5ed27 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Use FindTagLib from ECM

And make use of its imported target
parent 48c4376c
......@@ -9,7 +9,7 @@ set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE
project(k3b VERSION ${RELEASE_SERVICE_VERSION})
set (QT_MIN_VERSION "5.10.0")
set (KF5_MIN_VERSION "5.56.0")
set (KF5_MIN_VERSION "5.72.0")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" "${ECM_MODULE_PATH}")
......
# - Try to find the Taglib library
# Once done this will define
#
# TAGLIB_FOUND - system has the taglib library
# TAGLIB_CFLAGS - the taglib cflags
# TAGLIB_LIBRARIES - The libraries needed to use taglib
# SPDX-FileCopyrightText: 2006 Laurent Montel <montel@kde.org>
# SPDX-License-Identifier: BSD-3-Clause
if(NOT TAGLIB_MIN_VERSION)
set(TAGLIB_MIN_VERSION "1.4")
endif(NOT TAGLIB_MIN_VERSION)
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)
# 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: version: ${TAGLIB_VERSION}, libs: ${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
PATHS
${KDE4_INCLUDE_DIR}
${INCLUDE_INSTALL_DIR}
)
find_library_with_debug(TAGLIB_LIBRARIES
WIN32_DEBUG_POSTFIX d
NAMES tag
PATHS
${KDE4_LIB_DIR}
${LIB_INSTALL_DIR}
)
find_package_handle_standard_args(Taglib DEFAULT_MSG
TAGLIB_INCLUDES TAGLIB_LIBRARIES)
endif(TAGLIBCONFIG_EXECUTABLE)
if(TAGLIB_FOUND)
if(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE)
message(STATUS "Taglib found: ${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)
......@@ -18,10 +18,10 @@ configure_file(config-flac.h.cmake config-flac.h )
kcoreaddons_add_plugin(k3bflacdecoder SOURCES k3bflacdecoder.cpp INSTALL_NAMESPACE "k3b")
kcoreaddons_desktop_to_json(k3bflacdecoder "k3bflacdecoder.desktop" SERVICE_TYPES ${CMAKE_SOURCE_DIR}/libk3b/plugin/k3bplugin.desktop)
target_include_directories(k3bflacdecoder PRIVATE ${FLAC++_INCLUDE_DIR} ${FLAC_INCLUDE_DIR} ${TAGLIB_INCLUDES})
target_include_directories(k3bflacdecoder PRIVATE ${FLAC++_INCLUDE_DIR} ${FLAC_INCLUDE_DIR})
target_link_libraries(k3bflacdecoder k3bdevice k3blib KF5::I18n ${FLAC++_LIBRARIES} ${FLAC_LIBRARIES})
if(ENABLE_TAGLIB)
target_link_libraries(k3bflacdecoder ${TAGLIB_LIBRARIES})
target_link_libraries(k3bflacdecoder Taglib::Taglib)
endif()
kcoreaddons_add_plugin(k3bmaddecoder SOURCES k3bmad.cpp k3bmaddecoder.cpp INSTALL_NAMESPACE "k3b")
kcoreaddons_desktop_to_json(k3bmaddecoder "k3bmaddecoder.desktop" SERVICE_TYPES ${CMAKE_SOURCE_DIR}/libk3b/plugin/k3bplugin.desktop)
target_include_directories(k3bmaddecoder PRIVATE ${MAD_INCLUDE_DIR} ${TAGLIB_INCLUDES})
target_include_directories(k3bmaddecoder PRIVATE ${MAD_INCLUDE_DIR})
target_link_libraries(k3bmaddecoder k3bdevice k3blib KF5::I18n ${MAD_LIBRARIES})
if(ENABLE_TAGLIB)
target_link_libraries(k3bmaddecoder ${TAGLIB_LIBRARIES})
target_link_libraries(k3bmaddecoder Taglib::Taglib)
endif()
include_directories(${TAGLIB_INCLUDES})
kcoreaddons_add_plugin(k3baudiometainforenamerplugin SOURCES k3baudiometainforenamerplugin.cpp INSTALL_NAMESPACE "k3b")
kcoreaddons_desktop_to_json(k3baudiometainforenamerplugin "k3baudiometainforenamerplugin.desktop" SERVICE_TYPES ${CMAKE_SOURCE_DIR}/libk3b/plugin/k3bplugin.desktop)
......@@ -7,5 +5,5 @@ target_link_libraries(k3baudiometainforenamerplugin
k3bdevice
k3blib
KF5::I18n
${TAGLIB_LIBRARIES}
Taglib::Taglib
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment