[Kde-pim] KDE/kdepimlibs/cmake/modules
Alexander Neundorf
neundorf at kde.org
Wed Dec 3 18:46:44 GMT 2008
SVN commit 892180 by neundorf:
-add GPGME_LIBRARY_DIR to FindGpgme.cmake, which can be used as a hint in FindQGpgme.cmake when searching for qgpgme
-actually search for qgpgme in FindQgpgme.cmake instead of just assuming it's there (this breaks if the libraries found in FindGpgme.cmake are in /usr/lib, but qgpgme is e.g. in /opt/kdesupport/lib, in that case the link directory for qgpgme wasn't added)
Does anybody know what the comment "ensure that they are cached" and the following lines are supposed to do ?
CCMAIL: kde-pim at kde.org
Alex
M +11 -1 FindGpgme.cmake
M +28 -21 FindQGpgme.cmake
--- trunk/KDE/kdepimlibs/cmake/modules/FindGpgme.cmake #892179:892180
@@ -20,6 +20,7 @@
# - GPGME_INCLUDES is the same for all of the above
# - GPGME_FOUND is set if any of the above was found
#
+# GPGME_LIBRARY_DIR - the directory where the libraries are located
#
# THIS IS ALMOST A 1:1 COPY OF FindAssuan.cmake in kdepim.
@@ -53,6 +54,8 @@
# in cmake, AND and OR have the same precedence, there's no
# subexpressions, and expressions are evaluated short-circuit'ed
# IOW: CMake if() suxx.
+ # Starting with CMake 2.6.3 you can group if expressions with (), but we
+ # don't require 2.6.3 but 2.6.2, we can't use it. Alex
set( _seem_to_have_cached_gpgme false )
if ( GPGME_INCLUDES )
if ( GPGME_VANILLA_LIBRARIES OR GPGME_QT_LIBRARIES OR GPGME_GLIB_LIBRARIES )
@@ -290,6 +293,7 @@
endforeach( _flavour )
# ensure that they are cached
+ # This comment above doesn't make sense, the four following lines seem to do nothing. Alex
set( GPGME_INCLUDES ${GPGME_INCLUDES} )
set( GPGME_VANILLA_LIBRARIES ${GPGME_VANILLA_LIBRARIES} )
set( GPGME_PTHREAD_LIBRARIES ${GPGME_PTHREAD_LIBRARIES} )
@@ -345,6 +349,12 @@
set( _gpgme_flavours "${_gpgme_flavours} pth" )
endif()
+# determine the library in one of the found flavours, can be reused e.g. by FindQgpgme.cmake, Alex
+foreach(_currentFlavour vanilla glib qt pth pthread)
+ if(NOT GPGME_LIBRARY_DIR)
+ get_filename_component(GPGME_LIBRARY_DIR "${_gpgme_${_currentFlavour}_lib}" PATH)
+ endif()
+endforeach()
if ( NOT Gpgme_FIND_QUIETLY )
@@ -375,7 +385,7 @@
else()
if ( Gpgme_FIND_REQUIRED AND NOT GPGME_FOUND )
- message( FATAL_ERROR "" )
+ message( FATAL_ERROR "Did not find GPGME" )
endif()
endif()
--- trunk/KDE/kdepimlibs/cmake/modules/FindQGpgme.cmake #892179:892180
@@ -3,33 +3,40 @@
#
# QGPGME_FOUND
# QGPGME_LIBRARIES
+# QGPGME_INCLUDE_DIR
# What we do here is a bit simplictic, but it's no worse than what
# people were using in kdepim up to now...
-set( QGPGME_FOUND false )
-
find_package(Gpgme)
-if ( WIN32 AND GPGME_VANILLA_FOUND )
- set( QGPGME_FOUND true )
- set( QGPGME_LIBRARIES "qgpgme;gpgme++;${GPGME_VANILLA_LIBRARIES}" )
-endif( WIN32 AND GPGME_VANILLA_FOUND )
+if(GPGME_FOUND)
-if ( NOT WIN32 AND GPGME_PTHREAD_FOUND )
- set( QGPGME_FOUND true )
- set( QGPGME_LIBRARIES "qgpgme;gpgme++-pthread;${GPGME_PTHREAD_LIBRARIES}" )
-endif( NOT WIN32 AND GPGME_PTHREAD_FOUND )
+ if ( WIN32 )
+ find_library(_QGPGME_EXTRA_LIBRARY gpgme++
+ HINTS ${GPGME_LIBRARY_DIR})
+ else ( WIN32 )
+ find_library(_QGPGME_EXTRA_LIBRARY gpgme++-pthread
+ HINTS ${GPGME_LIBRARY_DIR})
+ endif ( WIN32 )
-if ( QGPGME_FOUND )
- if( NOT QGpgme_FIND_QUIETLY)
- message( STATUS "Found qgpgme: libraries: ${QGPGME_LIBRARIES}" )
- endif( NOT QGpgme_FIND_QUIETLY )
-else( QGPGME_FOUND )
- if( QGpgme_FIND_REQUIRED )
- message( FATAL_ERROR "Did NOT find qgpgme" )
- else( QGpgme_FIND_REQUIRED )
- message( STATUS "Did NOT find qgpgme" )
- endif( QGpgme_FIND_REQUIRED )
-endif( QGPGME_FOUND )
+ find_library(QGPGME_LIBRARY qgpgme
+ HINTS ${GPGME_LIBRARY_DIR})
+ if (QGPGME_LIBRARY)
+ # get the libdirectory and then go one up
+ get_filename_component(_QGPGME_PREFIX "${QGPGME_LIBRARY}" PATH)
+ get_filename_component(_QGPGME_PREFIX "${_QGPGME_PREFIX}" PATH)
+ find_path(QGPGME_INCLUDE_DIR qgpgme/qgpgme_export.h
+ HINTS "${_QGPGME_PREFIX}/include" )
+ endif (QGPGME_LIBRARY)
+
+ set(QGPGME_LIBRARIES ${QGPGME_LIBRARY} ${_QGPGME_EXTRA_LIBRARY} ${GPGME_PTHREAD_LIBRARIES})
+
+endif(GPGME_FOUND)
+
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(QGpgme DEFAULT_MSG QGPGME_LIBRARY QGPGME_INCLUDE_DIR _QGPGME_EXTRA_LIBRARY)
+
+mark_as_advanced(QGPGME_LIBRARY _QGPGME_EXTRA_LIBRARY QGPGME_INCLUDE_DIR)
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list