Warning, /maui/vvave/cmake/FindTagLib.cmake is written in an unsupported language. File is not indexed.

0001 # - Try to find the Taglib library
0002 # Once done this will define
0003 #
0004 #  TAGLIB_FOUND - system has the taglib library
0005 #  TAGLIB_CFLAGS - the taglib cflags
0006 #  TAGLIB_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_MIN_VERSION)
0014   set(TAGLIB_MIN_VERSION "1.4")
0015 endif(NOT TAGLIB_MIN_VERSION)
0016 
0017 if(NOT WIN32)
0018     find_program(TAGLIBCONFIG_EXECUTABLE NAMES taglib-config PATHS
0019        ${BIN_INSTALL_DIR}
0020     )
0021 endif(NOT WIN32)
0022 
0023 #reset vars
0024 set(TAGLIB_LIBRARIES)
0025 set(TAGLIB_CFLAGS)
0026 
0027 # if taglib-config has been found
0028 if(TAGLIBCONFIG_EXECUTABLE)
0029 
0030   exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_VERSION)
0031 
0032   if(TAGLIB_VERSION VERSION_LESS "${TAGLIB_MIN_VERSION}")
0033      message(STATUS "TagLib version not found: version searched :${TAGLIB_MIN_VERSION}, found ${TAGLIB_VERSION}")
0034      set(TAGLIB_FOUND FALSE)
0035   else(TAGLIB_VERSION VERSION_LESS "${TAGLIB_MIN_VERSION}")
0036 
0037      exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_LIBRARIES)
0038 
0039      exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_CFLAGS)
0040 
0041      if(TAGLIB_LIBRARIES AND TAGLIB_CFLAGS)
0042         set(TAGLIB_FOUND TRUE)
0043         message(STATUS "Found taglib: ${TAGLIB_LIBRARIES}")
0044      endif(TAGLIB_LIBRARIES AND TAGLIB_CFLAGS)
0045      string(REGEX REPLACE " *-I" ";" TAGLIB_INCLUDES "${TAGLIB_CFLAGS}")
0046      string(SUBSTRING ${TAGLIB_INCLUDES} 0 -1 TAGLIB_INCLUDES)
0047   endif(TAGLIB_VERSION VERSION_LESS "${TAGLIB_MIN_VERSION}")
0048   mark_as_advanced(TAGLIB_CFLAGS TAGLIB_LIBRARIES TAGLIB_INCLUDES)
0049 
0050 else(TAGLIBCONFIG_EXECUTABLE)
0051 
0052   include(FindLibraryWithDebug)
0053   include(FindPackageHandleStandardArgs)
0054 
0055   find_path(TAGLIB_INCLUDES
0056     NAMES
0057     tag.h
0058     PATH_SUFFIXES taglib
0059     PATHS
0060     ${KDE4_INCLUDE_DIR}
0061     ${INCLUDE_INSTALL_DIR}
0062   )
0063   list(APPEND TAGLIB_INCLUDES "${TAGLIB_INCLUDES}/..")
0064 
0065   find_library_with_debug(TAGLIB_LIBRARIES
0066     WIN32_DEBUG_POSTFIX d
0067     NAMES tag
0068     PATHS
0069     ${KDE4_LIB_DIR}
0070     ${LIB_INSTALL_DIR}
0071   )
0072   
0073   find_package_handle_standard_args(Taglib DEFAULT_MSG 
0074                                     TAGLIB_INCLUDES TAGLIB_LIBRARIES)
0075 endif(TAGLIBCONFIG_EXECUTABLE)
0076 
0077 
0078 if(TAGLIB_FOUND)
0079   if(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE)
0080     message(STATUS "Taglib found: ${TAGLIB_LIBRARIES}")
0081   endif(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE)
0082 else(TAGLIB_FOUND)
0083   if(Taglib_FIND_REQUIRED)
0084     message(FATAL_ERROR "Could not find Taglib")
0085   endif(Taglib_FIND_REQUIRED)
0086 endif(TAGLIB_FOUND)
0087