1
# - Try to find the Taglib library
2
# Once done this will define
4
# TAGLIB_FOUND - system has the taglib library
5
# TAGLIB_CFLAGS - the taglib cflags
6
# TAGLIB_LIBRARIES - The libraries needed to use taglib
8
# Copyright (c) 2006, Laurent Montel, <montel@kde.org>
10
# Redistribution and use is allowed according to the terms of the BSD license.
11
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
13
if(NOT TAGLIB_MIN_VERSION)
14
set(TAGLIB_MIN_VERSION "1.6")
15
endif(NOT TAGLIB_MIN_VERSION)
18
find_program(TAGLIBCONFIG_EXECUTABLE NAMES taglib-config PATHS
27
# if taglib-config has been found
28
if(TAGLIBCONFIG_EXECUTABLE)
30
exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_VERSION)
32
if(TAGLIB_VERSION STRLESS "${TAGLIB_MIN_VERSION}")
33
message(STATUS "TagLib version too old: version searched :${TAGLIB_MIN_VERSION}, found ${TAGLIB_VERSION}")
34
set(TAGLIB_FOUND FALSE)
35
else(TAGLIB_VERSION STRLESS "${TAGLIB_MIN_VERSION}")
37
exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_LIBRARIES)
39
exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_CFLAGS)
41
if(TAGLIB_LIBRARIES AND TAGLIB_CFLAGS)
42
set(TAGLIB_FOUND TRUE)
43
endif(TAGLIB_LIBRARIES AND TAGLIB_CFLAGS)
44
string(REGEX REPLACE " *-I" ";" TAGLIB_INCLUDES "${TAGLIB_CFLAGS}")
45
endif(TAGLIB_VERSION STRLESS "${TAGLIB_MIN_VERSION}")
46
mark_as_advanced(TAGLIB_CFLAGS TAGLIB_LIBRARIES TAGLIB_INCLUDES)
48
else(TAGLIBCONFIG_EXECUTABLE)
50
find_path(TAGLIB_INCLUDES
56
${INCLUDE_INSTALL_DIR}
60
# on non-win32 we don't need to take care about WIN32_DEBUG_POSTFIX
62
FIND_LIBRARY(TAGLIB_LIBRARIES tag PATHS ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR})
66
# 1. get all possible libnames
67
SET(args PATHS ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR})
69
SET(libnames_release "")
70
SET(libnames_debug "")
72
LIST(LENGTH args listCount)
75
LIST(APPEND libnames_release "tag")
76
LIST(APPEND libnames_debug "tagd")
80
# search the release lib
81
FIND_LIBRARY(TAGLIB_LIBRARIES_RELEASE
82
NAMES ${libnames_release}
86
# search the debug lib
87
FIND_LIBRARY(TAGLIB_LIBRARIES_DEBUG
88
NAMES ${libnames_debug}
92
IF(TAGLIB_LIBRARIES_RELEASE AND TAGLIB_LIBRARIES_DEBUG)
95
SET(TAGLIB_LIBRARIES optimized ${TAGLIB_LIBRARIES_RELEASE}
96
debug ${TAGLIB_LIBRARIES_DEBUG})
98
ELSE(TAGLIB_LIBRARIES_RELEASE AND TAGLIB_LIBRARIES_DEBUG)
100
IF(TAGLIB_LIBRARIES_RELEASE)
103
SET(TAGLIB_LIBRARIES ${TAGLIB_LIBRARIES_RELEASE})
105
ELSE(TAGLIB_LIBRARIES_RELEASE)
107
# only debug (or nothing) found
108
SET(TAGLIB_LIBRARIES ${TAGLIB_LIBRARIES_DEBUG})
110
ENDIF(TAGLIB_LIBRARIES_RELEASE)
112
ENDIF(TAGLIB_LIBRARIES_RELEASE AND TAGLIB_LIBRARIES_DEBUG)
114
MARK_AS_ADVANCED(TAGLIB_LIBRARIES_RELEASE)
115
MARK_AS_ADVANCED(TAGLIB_LIBRARIES_DEBUG)
119
INCLUDE(FindPackageMessage)
120
INCLUDE(FindPackageHandleStandardArgs)
121
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Taglib DEFAULT_MSG TAGLIB_INCLUDES TAGLIB_LIBRARIES)
123
endif(TAGLIBCONFIG_EXECUTABLE)
127
if(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE)
128
message(STATUS "Taglib found: ${TAGLIB_LIBRARIES}")
129
endif(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE)
131
if(Taglib_FIND_REQUIRED)
132
message(FATAL_ERROR "Could not find Taglib")
133
endif(Taglib_FIND_REQUIRED)