Blob Blame History Raw
Index: cmake/modules/FindLibgadu.cmake
===================================================================
--- cmake/modules/FindLibgadu.cmake	(Revision 0)
+++ cmake/modules/FindLibgadu.cmake	(Revision 909145)
@@ -0,0 +1,72 @@
+# - Try to find libgadu (Gadu Gadu protocol support library)
+# Once done this will define
+#
+#  LIBGADU_FOUND - system has LIBGADU
+#  LIBGADU_INCLUDE_DIR - the LIBGADU include directory
+#  LIBGADU_LIBRARIES - the libraries needed to use LIBGADU
+#  LIBGADU_DEFINITIONS - Compiler switches required for using LIBGADU
+#
+# use pkg-config to get the directories and then use these values
+# in the FIND_PATH() and FIND_LIBRARY() calls
+
+# Copyright (c) 2008, Maciej Mrozowski, <reavertm@poczta.fm>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+include (FindLibraryWithDebug)
+
+if (LIBGADU_INCLUDE_DIR AND LIBGADU_LIBRARIES)
+
+    # in cache already
+    set (LIBGADU_FOUND TRUE)
+
+else (LIBGADU_INCLUDE_DIR AND LIBGADU_LIBRARIES)
+
+    if (NOT WIN32)
+
+        find_package (PkgConfig)
+        pkg_check_modules (PC_LIBGADU libgadu)
+
+        # If pkgconfig found libgadu, 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_LIBGADU_FOUND)
+
+            set (LIBGADU_DEFINITIONS ${PC_LIBGADU_CFLAGS})
+
+            if (PC_LIBGADU_INCLUDE_DIRS)
+                set (LIBGADU_INCLUDE_DIR ${PC_LIBGADU_INCLUDE_DIRS})
+            else (PC_LIBGADU_INCLUDE_DIRS)
+                find_path (LIBGADU_INCLUDE_DIR libgadu.h PATH_SUFFIXES libgadu)
+            endif (PC_LIBGADU_INCLUDE_DIRS)
+
+            find_library (LIBGADU_LIBRARIES NAMES gadu
+                PATHS
+                ${PC_LIBGADU_LIBDIR}
+                NO_DEFAULT_PATH
+            )
+
+        else (PC_LIBGADU_FOUND)
+
+            find_library (LIBGADU_LIBRARIES NAMES gadu)
+            find_path (LIBGADU_INCLUDE_DIR libgadu.h PATH_SUFFIXES libgadu)
+
+        endif (PC_LIBGADU_FOUND)
+
+    else (NOT WIN32)
+
+        find_library_with_debug (LIBGADU_LIBRARIES
+            WIN32_DEBUG_POSTFIX d
+            NAMES gadu
+        )
+        find_path (LIBGADU_INCLUDE_DIR libgadu.h PATH_SUFFIXES libgadu)
+
+    endif (NOT WIN32)
+
+    include (FindPackageHandleStandardArgs)
+    find_package_handle_standard_args (LIBGADU DEFAULT_MSG LIBGADU_LIBRARIES LIBGADU_INCLUDE_DIR)
+
+    mark_as_advanced (LIBGADU_INCLUDE_DIR LIBGADU_LIBRARIES)
+
+endif (LIBGADU_INCLUDE_DIR AND LIBGADU_LIBRARIES)
Index: kopete/protocols/gadu/CMakeLists.txt
===================================================================
--- kopete/protocols/gadu/CMakeLists.txt	(Revision 909143)
+++ kopete/protocols/gadu/CMakeLists.txt	(Revision 909145)
@@ -3,11 +3,8 @@
 KDE4_NO_ENABLE_FINAL(kopete)
 
 add_subdirectory( icons ) 
-add_subdirectory( libgadu )
 
-include_directories( ${KOPETE_INCLUDES} 
-${CMAKE_CURRENT_SOURCE_DIR}/libgadu/ 
-${CMAKE_CURRENT_BINARY_DIR}/libgadu/ 
+include_directories( ${KOPETE_INCLUDES} ${LIBGADU_INCLUDE_DIRS} }
 )
 
 
@@ -46,7 +43,7 @@
 kde4_add_plugin(kopete_gadu ${kopete_gadu_PART_SRCS})
 
 
-target_link_libraries(kopete_gadu ${KDE4_KIO_LIBS} ${QT_QTNETWORK_LIBRARY} ${KDE4_KDE3SUPPORT_LIBS} gadu_kopete kopete )
+target_link_libraries(kopete_gadu ${KDE4_KIO_LIBS} ${QT_QTNETWORK_LIBRARY} ${KDE4_KDE3SUPPORT_LIBS} ${LIBGADU_LIBRARIES} kopete )
 
 install(TARGETS kopete_gadu  DESTINATION ${PLUGIN_INSTALL_DIR})
 
Index: kopete/protocols/CMakeLists.txt
===================================================================
--- kopete/protocols/CMakeLists.txt	(Revision 909143)
+++ kopete/protocols/CMakeLists.txt	(Revision 909145)
@@ -1,6 +1,3 @@
-macro_optional_find_package(OpenSSL)
-macro_log_feature(OPENSSL_FOUND "OpenSSL" "A toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols" "http://openssl.org" FALSE "" "Required for the Kopete Gadu-Gadu protocol.")
-
 # On Solaris, some of the name resolution functions are in libnsl;
 # this needs to be linked in if found. Copied from kdelibs.
 check_library_exists(nsl gethostbyname "" HAVE_NSL_LIBRARY)
@@ -47,9 +44,9 @@
   if(WITH_winpopup)
     add_subdirectory( winpopup )
   endif(WITH_winpopup)
-  if(WITH_gadu AND OPENSSL_FOUND)
+  if(WITH_gadu AND LIBGADU_FOUND)
 	add_subdirectory( gadu )
-  endif(WITH_gadu AND OPENSSL_FOUND)
+  endif(WITH_gadu AND LIBGADU_FOUND)
   if(WITH_sms)
     add_subdirectory( sms )
   endif(WITH_sms)
Index: kopete/CMakeLists.txt
===================================================================
--- kopete/CMakeLists.txt	(Revision 909143)
+++ kopete/CMakeLists.txt	(Revision 909145)
@@ -37,6 +37,10 @@
 macro_bool_to_01(LIBMEANWHILE_FOUND HAVE_LIBMEANWHILE)
 macro_log_feature(LIBMEANWHILE_FOUND "libmeanwhile" "A library for protocol support for connection to Sametime servers" "http://meanwhile.sf.net" FALSE "" "Required for the Kopete Meanwhile protocol")
 
+macro_optional_find_package(Libgadu)
+macro_bool_to_01(LIBGADU_FOUND HAVE_LIBGADU)
+macro_log_feature(LIBGADU_FOUND "libgadu" "A library providing support for Gadu-Gadu protocol" "http://toxygen.net/libgadu/" FALSE "1.8.0" "Required for Kopete Gadu-Gadu protocol")
+
 check_include_files(valgrind/valgrind.h HAVE_VALGRIND_H)
 check_include_files(stdint.h HAVE_STDINT_H)
 check_include_files(inttypes.h HAVE_INTTYPES_H)