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/FindQCA2.cmake | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) (limited to 'modules/FindQCA2.cmake') diff --git a/modules/FindQCA2.cmake b/modules/FindQCA2.cmake index fe4b0766..6b82a965 100644 --- a/modules/FindQCA2.cmake +++ b/modules/FindQCA2.cmake @@ -27,33 +27,20 @@ else (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES) if (NOT WIN32) find_package(PkgConfig) pkg_check_modules(PC_QCA2 qca2) - - # If pkgconfig found QCA2, get the full path to the library using find_library() - # but only in the path reported by pkgconfig. - # Otherwise do a normal search. - if(PC_QCA2_FOUND) - set(QCA2_DEFINITIONS ${PC_QCA2_CFLAGS}) - set(QCA2_INCLUDE_DIR ${PC_QCA2_INCLUDE_DIRS}) - find_library(QCA2_LIBRARIES NAMES qca - PATHS - ${PC_QCA2_LIBDIR} - NO_DEFAULT_PATH - ) - else(PC_QCA2_FOUND) - find_library(QCA2_LIBRARIES NAMES qca ) - find_path(QCA2_INCLUDE_DIR qca.h PATH_SUFFIXES QtCrypto) - endif(PC_QCA2_FOUND) - - else (NOT WIN32) - find_library_with_debug(QCA2_LIBRARIES - WIN32_DEBUG_POSTFIX d - NAMES qca) - - find_path(QCA2_INCLUDE_DIR qca.h PATH_SUFFIXES QtCrypto) + set(QCA2_DEFINITIONS ${PC_QCA2_CFLAGS_OTHER}) endif (NOT WIN32) - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(QCA2 DEFAULT_MSG QCA2_LIBRARIES QCA2_INCLUDE_DIR) + find_library_with_debug(QCA2_LIBRARIES + WIN32_DEBUG_POSTFIX d + HINTS ${PC_QCA2_LIBDIR} ${PC_QCA2_LIBRARY_DIRS} + NAMES qca) + + find_path(QCA2_INCLUDE_DIR qca.h + HINTS ${PC_QCA2_INCLUDEDIR} ${PC_QCA2_INCLUDE_DIRS} + PATH_SUFFIXES QtCrypto) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(QCA2 DEFAULT_MSG QCA2_LIBRARIES QCA2_INCLUDE_DIR) mark_as_advanced(QCA2_INCLUDE_DIR QCA2_LIBRARIES) -- cgit v1.2.1