From c379d4c4e0655fac2dadd4be57e2e5cd23d40572 Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Tue, 2 Dec 2008 21:49:01 +0000 Subject: -rework all uses of find_package(PkgConfig)/pkg_check_modules(): the prefix used for pkgconfig config (e.g. SQLITE) now *always* gets an additional "PC_" prefix, so the prefix used for pkgconfig is now "PC_SQLITE_". This avoids name clashes between variables defined by the pkgconfig macro and the find module and unwanted effects. *Never* use the _CFLAGS coming from pkgconfig, but always CFLAGS_OTHER, since these shouldn't contain the include directories. If the include directories would be in the DEFINITIONS variable this could clash with the results of find_path() for finding include dirs. *Always* use both foo_INCLUDEDIR, foo_INCLUDE_DIRS for searching the include dir, and also both foo_LIBDIR and foo_LIBRARY_DIRS for searching the libraries. These directories coming from pkgconfig are *never* used exclusively, but *always* additionally to the standard search dirs, either before them (then using the "HINTS" keyword) or after them (then using the "PATHS" keyword) I hope I didn't break (too much) stuff. At least on my system it all seems to work the same way as it did before, with and without pkgconfig. Alex svn path=/trunk/KDE/kdelibs/; revision=891805 --- modules/FindXmms.cmake | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'modules/FindXmms.cmake') diff --git a/modules/FindXmms.cmake b/modules/FindXmms.cmake index 8d42b12f..c43893fb 100644 --- a/modules/FindXmms.cmake +++ b/modules/FindXmms.cmake @@ -1,9 +1,10 @@ # Search xmms -## Once done this will define +# Once done this will define # # XMMS_FOUND - system has xmms # XMMS_INCLUDE_DIRS - the xmms include directory -# XMMS_LDFLAGS - Link these to use xmms +# XMMS_LIBRARIES - Link these to use xmms +# XMMS_LDFLAGS - for compatibility only, same as XMMS_LIBRARIES # Copyright (c) 2006, 2007 Laurent Montel, # Copyright (c) 2007 Allen Winter @@ -11,29 +12,33 @@ # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. -if (XMMS_INCLUDE_DIRS AND XMMS_LDFLAGS) +if (XMMS_INCLUDE_DIRS AND XMMS_LIBRARIES) # in cache already - SET(XMMS_FOUND TRUE) + set(XMMS_FOUND TRUE) -else (XMMS_INCLUDE_DIRS AND XMMS_LDFLAGS) - IF (NOT WIN32) +else (XMMS_INCLUDE_DIRS AND XMMS_LIBRARIES) + if (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) - pkg_check_modules(XMMS xmms) - ENDIF(NOT WIN32) + pkg_check_modules(PC_XMMS xmms) + endif(NOT WIN32) - FIND_PATH(XMMS_INCLUDE_DIRS xmmsctrl.h - PATHS ${_XMMSIncDir} PATH_SUFFIXES xmms) + find_path(XMMS_INCLUDE_DIRS xmmsctrl.h + PATHS ${PC_XMMS_INCLUDEDIR} ${PC_XMMS_INCLUDE_DIRS} + PATH_SUFFIXES xmms) - FIND_LIBRARY(XMMS_LDFLAGS NAMES xmms - PATHS ${_XMMSLinkDir}) + find_library(XMMS_LIBRARIES NAMES xmms + PATHS ${PC_XMMS_LIBDIR} ${PC_XMMS_LIBRARY_DIRS}) - INCLUDE(FindPackageHandleStandardArgs) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(Xmms DEFAULT_MSG - XMMS_LDFLAGS XMMS_INCLUDE_DIRS) + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(Xmms DEFAULT_MSG + XMMS_LIBRARIES XMMS_INCLUDE_DIRS) - MARK_AS_ADVANCED(XMMS_INCLUDE_DIRS XMMS_LDFLAGS) + mark_as_advanced(XMMS_INCLUDE_DIRS XMMS_LIBRARIES) -endif (XMMS_INCLUDE_DIRS AND XMMS_LDFLAGS) +endif (XMMS_INCLUDE_DIRS AND XMMS_LIBRARIES) + +# for compatibility +set(XMMS_LDFLAGS ${XMMS_LIBRARIES}) -- cgit v1.2.1