Use pkg-config to support finding libraries
Using pkg-config helps to find libraries on systems where these libraries are installed in non-standard locations.
This commit is contained in:
@@ -5,17 +5,44 @@
|
||||
# AVAHI_INCLUDE_DIRS - the avahi include directories
|
||||
# AVAHI_LIBRARIES - The libraries needed to use avahi
|
||||
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the find_path() and find_library() calls
|
||||
find_package(PkgConfig)
|
||||
|
||||
find_library(AVAHI_COMMON_LIB avahi-common PATHS ${COMMON_LIB_DIR})
|
||||
find_library(AVAHI_CLIENT_LIB avahi-client PATHS ${CLIENT_LIB_DIR})
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_AVAHI avahi-client)
|
||||
endif(PKG_CONFIG_FOUND)
|
||||
|
||||
find_library(AVAHI_COMMON_LIB NAMES avahi-common
|
||||
PATHS
|
||||
${_AVAHI_LIBRARY_DIRS}
|
||||
${COMMON_LIB_DIR}
|
||||
)
|
||||
|
||||
find_library(AVAHI_CLIENT_LIB NAMES avahi-client
|
||||
PATHS
|
||||
${_AVAHI_LIBRARY_DIRS}
|
||||
${CLIENT_LIB_DIR}
|
||||
)
|
||||
|
||||
if(AVAHI_COMMON_LIB AND AVAHI_CLIENT_LIB)
|
||||
set(AVAHI_LIBRARIES ${AVAHI_COMMON_LIB} ${AVAHI_CLIENT_LIB})
|
||||
message(STATUS "Avahi-Libs found: ${AVAHI_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
find_path(COMMON_INCLUDE_DIR watch.h PATH_SUFFIXES avahi-common HINTS ${COMMON_INCLUDE_DIR})
|
||||
find_path(CLIENT_INCLUDE_DIR client.h PATH_SUFFIXES avahi-client HINTS ${CLIENT_INCLUDE_DIR})
|
||||
find_path(COMMON_INCLUDE_DIR watch.h
|
||||
PATH_SUFFIXES avahi-common
|
||||
PATHS
|
||||
${_AVAHI_INCLUDE_DIRS}
|
||||
${COMMON_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
find_path(CLIENT_INCLUDE_DIR client.h
|
||||
PATH_SUFFIXES avahi-client
|
||||
PATHS
|
||||
${_AVAHI_INCLUDE_DIRS}
|
||||
${CLIENT_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
if(COMMON_INCLUDE_DIR AND CLIENT_INCLUDE_DIR)
|
||||
set(AVAHI_INCLUDE_DIRS ${COMMON_INCLUDE_DIR} ${CLIENT_INCLUDE_DIR})
|
||||
|
||||
@@ -1,12 +1,26 @@
|
||||
# - Try to find CDDB
|
||||
# Once done this will define
|
||||
#
|
||||
# CDDB_FOUND - system has UDev
|
||||
# CDDB_INCLUDE_DIR - the libudev include directory
|
||||
# CDDB_LIBS - The libudev libraries
|
||||
# CDDB_FOUND - system has CDDB
|
||||
# CDDB_INCLUDE_DIR - the libcddb include directory
|
||||
# CDDB_LIBS - The libcddb libraries
|
||||
|
||||
find_path(CDDB_INCLUDE_DIR cddb/cddb.h)
|
||||
find_library(CDDB_LIBS cddb)
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the find_path() and find_library() calls
|
||||
find_package(PkgConfig)
|
||||
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_CDDB libcddb)
|
||||
endif(PKG_CONFIG_FOUND)
|
||||
|
||||
find_path(CDDB_INCLUDE_DIR cddb/cddb.h
|
||||
${_CDDB_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
find_library(CDDB_LIBS NAMES cddb
|
||||
PATHS
|
||||
${_CDDB_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(CDDB DEFAULT_MSG CDDB_INCLUDE_DIR CDDB_LIBS)
|
||||
|
||||
@@ -6,10 +6,19 @@
|
||||
#
|
||||
set(EBUR128_FOUND FALSE)
|
||||
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the find_path() and find_library() calls
|
||||
find_package(PkgConfig)
|
||||
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_EBUR128 libebur128)
|
||||
endif(PKG_CONFIG_FOUND)
|
||||
|
||||
find_path(EBUR128_INCLUDE_DIR ebur128.h
|
||||
HINTS
|
||||
PATH_SUFFIXES include
|
||||
PATHS
|
||||
${_EBUR128_INCLUDE_DIRS}
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include
|
||||
@@ -26,6 +35,7 @@ find_library(EBUR128_LIBRARY
|
||||
HINTS
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS
|
||||
${_EBUR128_LIBRARY_DIRS}
|
||||
/usr/local
|
||||
/usr
|
||||
/sw
|
||||
|
||||
@@ -16,29 +16,25 @@ if(NOT TAGLIB_MIN_VERSION)
|
||||
set(TAGLIB_MIN_VERSION "1.6")
|
||||
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)
|
||||
find_package(PkgConfig)
|
||||
|
||||
exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_VERSION)
|
||||
# if pkg-config has been found
|
||||
if(PKG_CONFIG_EXECUTABLE)
|
||||
|
||||
exec_program(${PKG_CONFIG_EXECUTABLE} ARGS --modversion taglib 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(TAGLIB_VERSION VERSION_LESS "${TAGLIB_MIN_VERSION}")
|
||||
|
||||
exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_LIBRARIES)
|
||||
exec_program(${PKG_CONFIG_EXECUTABLE} ARGS --libs taglib RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_LIBRARIES)
|
||||
|
||||
exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_CFLAGS)
|
||||
exec_program(${PKG_CONFIG_EXECUTABLE} ARGS --cflags taglib RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_CFLAGS)
|
||||
|
||||
if(TAGLIB_LIBRARIES AND TAGLIB_CFLAGS)
|
||||
set(TAGLIB_FOUND TRUE)
|
||||
@@ -47,7 +43,7 @@ if(TAGLIBCONFIG_EXECUTABLE)
|
||||
endif(TAGLIB_VERSION VERSION_LESS "${TAGLIB_MIN_VERSION}")
|
||||
mark_as_advanced(TAGLIB_CFLAGS TAGLIB_LIBRARIES TAGLIB_INCLUDES)
|
||||
|
||||
else(TAGLIBCONFIG_EXECUTABLE)
|
||||
else(PKG_CONFIG_EXECUTABLE)
|
||||
|
||||
find_path(TAGLIB_INCLUDES
|
||||
NAMES
|
||||
@@ -122,13 +118,13 @@ else(TAGLIBCONFIG_EXECUTABLE)
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Taglib DEFAULT_MSG TAGLIB_INCLUDES TAGLIB_LIBRARIES)
|
||||
|
||||
endif(TAGLIBCONFIG_EXECUTABLE)
|
||||
endif(PKG_CONFIG_EXECUTABLE)
|
||||
|
||||
|
||||
if(TAGLIB_FOUND)
|
||||
if(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE)
|
||||
if(NOT Taglib_FIND_QUIETLY AND TAGLIB_LIBRARIES)
|
||||
message(STATUS "Taglib found: ${TAGLIB_LIBRARIES}")
|
||||
endif(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE)
|
||||
endif(NOT Taglib_FIND_QUIETLY AND TAGLIB_LIBRARIES)
|
||||
|
||||
if(NOT WIN32)
|
||||
set(TAGLIB_INCLUDES "${TAGLIB_INCLUDES};/usr/local/include")
|
||||
|
||||
@@ -10,8 +10,19 @@
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
find_path(UDEV_INCLUDE_DIR libudev.h)
|
||||
find_library(UDEV_LIBS udev)
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the find_path() and find_library() calls
|
||||
include(FindPkgConfig)
|
||||
pkg_check_modules(_UDEV libudev)
|
||||
|
||||
find_path(UDEV_INCLUDE_DIR libudev.h
|
||||
${_UDEV_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
find_library(UDEV_LIBS NAMES udev
|
||||
PATHS
|
||||
${_UDEV_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(UDev DEFAULT_MSG UDEV_INCLUDE_DIR UDEV_LIBS)
|
||||
|
||||
Reference in New Issue
Block a user