Warning, /multimedia/amarok/cmake/modules/FindTaglib-Extras.cmake is written in an unsupported language. File is not indexed.
0001 # - Try to find the Taglib-Extras library 0002 # Once done this will define 0003 # 0004 # TAGLIB-EXTRAS_FOUND - system has the taglib library 0005 # TAGLIB-EXTRAS_CFLAGS - the taglib cflags 0006 # TAGLIB-EXTRAS_LIBRARIES - The libraries needed to use taglib 0007 0008 # Copyright (c) 2006, Laurent Montel, <montel@kde.org> 0009 # 0010 # Redistribution and use is allowed according to the terms of the BSD license. 0011 # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 0012 0013 if(NOT TAGLIB-EXTRAS_MIN_VERSION) 0014 set(TAGLIB-EXTRAS_MIN_VERSION "1.0") 0015 endif() 0016 0017 if(NOT WIN32) 0018 find_program(TAGLIB-EXTRASCONFIG_EXECUTABLE NAMES taglib-extras-config PATHS 0019 ${BIN_INSTALL_DIR} 0020 ) 0021 endif() 0022 0023 #reset vars 0024 set(TAGLIB-EXTRAS_LIBRARIES) 0025 set(TAGLIB-EXTRAS_CFLAGS) 0026 0027 # if taglib-extras-config has been found 0028 if(TAGLIB-EXTRASCONFIG_EXECUTABLE) 0029 0030 exec_program(${TAGLIB-EXTRASCONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB-EXTRAS_VERSION) 0031 0032 if(TAGLIB-EXTRAS_VERSION VERSION_LESS "${TAGLIB-EXTRAS_MIN_VERSION}") 0033 message(STATUS "TagLib-Extras version too old: version searched :${TAGLIB-EXTRAS_MIN_VERSION}, found ${TAGLIB-EXTRAS_VERSION}") 0034 set(TAGLIB-EXTRAS_FOUND FALSE) 0035 else() 0036 0037 exec_program(${TAGLIB-EXTRASCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB-EXTRAS_LIBRARIES) 0038 0039 exec_program(${TAGLIB-EXTRASCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB-EXTRAS_CFLAGS) 0040 0041 if(TAGLIB-EXTRAS_LIBRARIES AND TAGLIB-EXTRAS_CFLAGS) 0042 set(TAGLIB-EXTRAS_FOUND TRUE) 0043 endif() 0044 string(REGEX REPLACE " *-I" ";" TAGLIB-EXTRAS_INCLUDES "${TAGLIB-EXTRAS_CFLAGS}") 0045 endif() 0046 mark_as_advanced(TAGLIB-EXTRAS_CFLAGS TAGLIB-EXTRAS_LIBRARIES TAGLIB-EXTRAS_INCLUDES) 0047 0048 else() 0049 0050 find_path(TAGLIB-EXTRAS_INCLUDES 0051 NAMES 0052 tfile_helper.h 0053 PATH_SUFFIXES taglib-extras 0054 PATHS 0055 ${INCLUDE_INSTALL_DIR} 0056 ) 0057 0058 if(NOT WIN32) 0059 # on non-win32 we don't need to take care about WIN32_DEBUG_POSTFIX 0060 0061 find_library(TAGLIB-EXTRAS_LIBRARIES tag-extras PATHS ${LIB_INSTALL_DIR}) 0062 0063 else() 0064 0065 # 1. get all possible libnames 0066 set(args PATHS ${LIB_INSTALL_DIR}) 0067 set(newargs "") 0068 set(libnames_release "") 0069 set(libnames_debug "") 0070 0071 list(LENGTH args listCount) 0072 0073 # just one name 0074 list(APPEND libnames_release "tag-extras") 0075 list(APPEND libnames_debug "tag-extrasd") 0076 0077 set(newargs ${args}) 0078 0079 # search the release lib 0080 find_library(TAGLIB-EXTRAS_LIBRARIES_RELEASE 0081 NAMES ${libnames_release} 0082 ${newargs} 0083 ) 0084 0085 # search the debug lib 0086 find_library(TAGLIB-EXTRAS_LIBRARIES_DEBUG 0087 NAMES ${libnames_debug} 0088 ${newargs} 0089 ) 0090 0091 if(TAGLIB-EXTRAS_LIBRARIES_RELEASE AND TAGLIB-EXTRAS_LIBRARIES_DEBUG) 0092 0093 # both libs found 0094 set(TAGLIB-EXTRAS_LIBRARIES optimized ${TAGLIB-EXTRAS_LIBRARIES_RELEASE} 0095 debug ${TAGLIB-EXTRAS_LIBRARIES_DEBUG}) 0096 0097 else() 0098 0099 if(TAGLIB-EXTRAS_LIBRARIES_RELEASE) 0100 0101 # only release found 0102 set(TAGLIB-EXTRAS_LIBRARIES ${TAGLIB-EXTRAS_LIBRARIES_RELEASE}) 0103 0104 else() 0105 0106 # only debug (or nothing) found 0107 set(TAGLIB-EXTRAS_LIBRARIES ${TAGLIB-EXTRAS_LIBRARIES_DEBUG}) 0108 0109 endif() 0110 0111 endif() 0112 0113 mark_as_advanced(TAGLIB-EXTRAS_LIBRARIES_RELEASE) 0114 mark_as_advanced(TAGLIB-EXTRAS_LIBRARIES_DEBUG) 0115 0116 endif() 0117 0118 include(FindPackageMessage) 0119 include(FindPackageHandleStandardArgs) 0120 find_package_handle_standard_args(Taglib-Extras DEFAULT_MSG TAGLIB-EXTRAS_INCLUDES TAGLIB-EXTRAS_LIBRARIES) 0121 0122 endif() 0123 0124 0125 if(TAGLIB-EXTRAS_FOUND) 0126 if(NOT Taglib-Extras_FIND_QUIETLY AND TAGLIB-EXTRASCONFIG_EXECUTABLE) 0127 message(STATUS "Taglib-Extras found: ${TAGLIB-EXTRAS_LIBRARIES}") 0128 endif() 0129 else() 0130 if(Taglib-Extras_FIND_REQUIRED) 0131 message(FATAL_ERROR "Could not find Taglib-Extras") 0132 endif() 0133 endif() 0134