summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorBe <be@mixxx.org>2020-11-16 11:04:41 -0600
committerBe <be@mixxx.org>2020-11-16 11:04:41 -0600
commitacbe21d6717a468d2482084c969e49b63c5cc4bd (patch)
treeefce65fbc44978c7ababc189b7f728347bcee1c4 /cmake
parent93217b3142b2ed7bdeeca445761653b35032b315 (diff)
parent19eba8c39364967e483fb0bf5e816b8addf66545 (diff)
Merge remote-tracking branch 'upstream/2.3' into main
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/FindTagLib.cmake87
-rw-r--r--cmake/modules/FindTaglib.cmake133
2 files changed, 87 insertions, 133 deletions
diff --git a/cmake/modules/FindTagLib.cmake b/cmake/modules/FindTagLib.cmake
new file mode 100644
index 0000000000..36da772b01
--- /dev/null
+++ b/cmake/modules/FindTagLib.cmake
@@ -0,0 +1,87 @@
+# This file is part of Mixxx, Digital DJ'ing software.
+# Copyright (C) 2001-2020 Mixxx Development Team
+# Distributed under the GNU General Public Licence (GPL) version 2 or any later
+# later version. See the LICENSE file for details.
+
+#[=======================================================================[.rst:
+FindTagLib
+-----------
+
+Finds the TagLib library.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+This module provides the following imported targets, if found:
+
+``TagLib::TagLib``
+ The TagLib library
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This will define the following variables:
+
+``TagLib_FOUND``
+ True if the system has the TagLib library.
+``TagLib_INCLUDE_DIRS``
+ Include directories needed to use TagLib.
+``TagLib_LIBRARIES``
+ Libraries needed to link to TagLib.
+``TagLib_DEFINITIONS``
+ Compile definitions needed to use TagLib.
+
+Cache Variables
+^^^^^^^^^^^^^^^
+
+The following cache variables may also be set:
+
+``TagLib_INCLUDE_DIR``
+ The directory containing ``ebur128.h``.
+``TagLib_LIBRARY``
+ The path to the TagLib library.
+
+#]=======================================================================]
+
+find_package(PkgConfig QUIET)
+if(PkgConfig_FOUND)
+ pkg_check_modules(PC_TagLib QUIET taglib)
+endif()
+
+find_path(TagLib_INCLUDE_DIR
+ NAMES tag.h
+ PATHS ${PC_TagLib_INCLUDE_DIRS}
+ PATH_SUFFIXES taglib
+ DOC "TagLib include directory")
+mark_as_advanced(TagLib_INCLUDE_DIR)
+
+find_library(TagLib_LIBRARY
+ NAMES tag
+ PATHS ${PC_TagLib_LIBRARY_DIRS}
+ DOC "TagLib library"
+)
+mark_as_advanced(TagLib_LIBRARY)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ TagLib
+ DEFAULT_MSG
+ TagLib_LIBRARY
+ TagLib_INCLUDE_DIR
+)
+
+if(TagLib_FOUND)
+ set(TagLib_LIBRARIES "${TagLib_LIBRARY}")
+ set(TagLib_INCLUDE_DIRS "${TagLib_INCLUDE_DIR}")
+ set(TagLib_DEFINITIONS ${PC_TagLib_CFLAGS_OTHER})
+
+ if(NOT TARGET TagLib::TagLib)
+ add_library(TagLib::TagLib UNKNOWN IMPORTED)
+ set_target_properties(TagLib::TagLib
+ PROPERTIES
+ IMPORTED_LOCATION "${TagLib_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${PC_TagLib_CFLAGS_OTHER}"
+ INTERFACE_INCLUDE_DIRECTORIES "${TagLib_INCLUDE_DIR}"
+ )
+ endif()
+endif()
diff --git a/cmake/modules/FindTaglib.cmake b/cmake/modules/FindTaglib.cmake
deleted file mode 100644
index 0ed3b3d39f..0000000000
--- a/cmake/modules/FindTaglib.cmake
+++ /dev/null
@@ -1,133 +0,0 @@
-# - 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
-
-# Copyright (c) 2006, Laurent Montel, <montel@kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-if(NOT TAGLIB_MIN_VERSION)
- set(TAGLIB_MIN_VERSION "1.7")
-endif()
-
-if(NOT WIN32)
- find_program(TAGLIBCONFIG_EXECUTABLE
- NAMES taglib-config
- PATHS ${BIN_INSTALL_DIR}
- )
-endif()
-
-#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 too old: version searched :${TAGLIB_MIN_VERSION}, found ${TAGLIB_VERSION}")
- set(TAGLIB_FOUND FALSE)
- else()
-
- 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)
- endif()
-
- string(REGEX REPLACE " *-I" ";" TAGLIB_INCLUDE_DIRS "${TAGLIB_CFLAGS}")
- string(SUBSTRING ${TAGLIB_INCLUDE_DIRS} 0 -1 TAGLIB_INCLUDE_DIRS) #we remove the initial ;
-endif()
-
-mark_as_advanced(TAGLIB_CFLAGS TAGLIB_LIBRARIES TAGLIB_INCLUDES)
-
-else()
-
- find_path(TAGLIB_INCLUDE_DIRS
- NAMES tag.h
- PATH_SUFFIXES taglib
- PATHS ${INCLUDE_INSTALL_DIR}
- )
-
- if(NOT WIN32)
- # on non-win32 we don't need to take care about WIN32_DEBUG_POSTFIX
- find_library(TAGLIB_LIBRARIES tag PATHS ${LIB_INSTALL_DIR})
-
- else()
-
- # 1. get all possible libnames
- set(args PATHS ${LIB_INSTALL_DIR})
- set(newargs "")
- set(libnames_release "")
- set(libnames_debug "")
-
- list(LENGTH args listCount)
-
- # just one name
- list(APPEND libnames_release "tag")
- list(APPEND libnames_debug "tagd")
-
- set(newargs ${args})
-
- # search the release lib
- find_library(TAGLIB_LIBRARIES_RELEASE
- NAMES ${libnames_release}
- ${newargs}
- )
-
- # search the debug lib
- find_library(TAGLIB_LIBRARIES_DEBUG
- NAMES ${libnames_debug}
- ${newargs}
- )
-
- if(TAGLIB_LIBRARIES_RELEASE AND TAGLIB_LIBRARIES_DEBUG)
-
- # both libs found
- set(TAGLIB_LIBRARIES optimized ${TAGLIB_LIBRARIES_RELEASE}
- debug ${TAGLIB_LIBRARIES_DEBUG}
- )
-
- else()
-
- if(TAGLIB_LIBRARIES_RELEASE)
- # only release found
- set(TAGLIB_LIBRARIES ${TAGLIB_LIBRARIES_RELEASE})
-
- else()
- # only debug (or nothing) found
- set(TAGLIB_LIBRARIES ${TAGLIB_LIBRARIES_DEBUG})
-
- endif()
-
- endif()
-
- mark_as_advanced(TAGLIB_LIBRARIES_RELEASE)
- mark_as_advanced(TAGLIB_LIBRARIES_DEBUG)
-
- endif()
-
- include(FindPackageMessage)
- include(FindPackageHandleStandardArgs)
- find_package_handle_standard_args(Taglib DEFAULT_MSG TAGLIB_LIBRARIES TAGLIB_INCLUDE_DIRS)
-
-endif()
-
-
-if(TAGLIB_FOUND)
- if(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE)
- message(STATUS "Taglib found: ${TAGLIB_LIBRARIES}")
- endif()
-else()
- if(Taglib_FIND_REQUIRED)
- message(FATAL_ERROR "Could not find Taglib")
- endif()
-endif()