[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [libnm-qt/8021x-make-pki-cool] /: Build vs QCA
From:       Will Stephenson <wstephenson () kde ! org>
Date:       2013-05-16 13:56:42
Message-ID: 20130516135642.435ADA6081 () git ! kde ! org
[Download RAW message or body]

Git commit 69f746fe0f6b512226e9acf5a64d1ef27fdcd679 by Will Stephenson.
Committed on 14/05/2013 at 15:48.
Pushed by wstephens into branch '8021x-make-pki-cool'.

Build vs QCA

M  +9    -1    CMakeLists.txt
A  +113  -0    FindLibraryWithDebug.cmake
A  +48   -0    FindQCA2.cmake

http://commits.kde.org/libnm-qt/69f746fe0f6b512226e9acf5a64d1ef27fdcd679

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9386fb..ffb1c8c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,11 @@ set(LIB_SUFFIX "" CACHE STRING "Define suffix of library=
 directory name (32/64)"
 =

 find_package(Qt4 REQUIRED)
 find_package(NetworkManager 0.9.8.0 REQUIRED)
+find_package(QCA2 REQUIRED)
+#include(KDE4Defaults)
+#macro_optional_find_package(QCA2)
+#macro_log_feature(QCA2_FOUND "QCA" "Qt Cryptographic Architecture (QCA)" =
"http://delta.affinix.com/qca/" FALSE "2.0.0" "Support for encrypted OpenDo=
cument Text documents in Okular.")
+
 =

 pkg_check_modules(LIBMODEMMANAGERQT REQUIRED ModemManagerQt)
 if (NOT LIBMODEMMANAGERQT_FOUND)
@@ -22,6 +27,9 @@ include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DI=
R} ${QT_INCLUDES}
                     ${LIBMODEMMANAGERQT_INCLUDE_DIRS} ${CMAKE_INCLUDE_PATH=
})
 link_directories(${LIBMODEMMANAGERQT_LIBRARY_DIRS} ${CMAKE_LIBRARY_PATH})
 =

+include_directories( ${QCA2_INCLUDE_DIR} )
+add_definitions( -DQCA2 )
+
 include_directories(
    ${NETWORKMANAGER_INCLUDE_DIRS}
    ${NM-UTIL_INCLUDE_DIRS}
@@ -206,7 +214,7 @@ add_library(NetworkManagerQt SHARED ${NetworkManagerQt_=
PART_SRCS} ${DBUS_INTERFA
 =

 # TODO: dlopen libModemManagerQt to make it a runtime dependency instead o=
f compile
 # time dependency.
-target_link_libraries(NetworkManagerQt ModemManagerQt ${QT_QTCORE_LIBRARY}=
 ${QT_QTDBUS_LIBRARY} ${QT_QTNETWORK_LIBRARY})
+target_link_libraries(NetworkManagerQt ModemManagerQt ${QT_QTCORE_LIBRARY}=
 ${QT_QTDBUS_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QCA2_LIBRARIES})
 install(TARGETS NetworkManagerQt DESTINATION lib${LIB_SUFFIX})
 =

 install( FILES
diff --git a/FindLibraryWithDebug.cmake b/FindLibraryWithDebug.cmake
new file mode 100644
index 0000000..58cd730
--- /dev/null
+++ b/FindLibraryWithDebug.cmake
@@ -0,0 +1,113 @@
+#
+#  FIND_LIBRARY_WITH_DEBUG
+#  -> enhanced FIND_LIBRARY to allow the search for an
+#     optional debug library with a WIN32_DEBUG_POSTFIX similar
+#     to CMAKE_DEBUG_POSTFIX when creating a shared lib
+#     it has to be the second and third argument
+
+# Copyright (c) 2007, Christian Ehrlicher, <ch.ehrlicher@gmx.de>
+# Redistribution and use is allowed according to the terms of the BSD lice=
nse.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+MACRO(FIND_LIBRARY_WITH_DEBUG var_name win32_dbg_postfix_name dgb_postfix =
libname)
+
+  IF(NOT "${win32_dbg_postfix_name}" STREQUAL "WIN32_DEBUG_POSTFIX")
+
+     # no WIN32_DEBUG_POSTFIX -> simply pass all arguments to FIND_LIBRARY
+     FIND_LIBRARY(${var_name}
+                  ${win32_dbg_postfix_name}
+                  ${dgb_postfix}
+                  ${libname}
+                  ${ARGN}
+     )
+
+  ELSE(NOT "${win32_dbg_postfix_name}" STREQUAL "WIN32_DEBUG_POSTFIX")
+
+    IF(NOT WIN32)
+      # on non-win32 we don't need to take care about WIN32_DEBUG_POSTFIX
+
+      FIND_LIBRARY(${var_name} ${libname} ${ARGN})
+
+    ELSE(NOT WIN32)
+
+      # 1. get all possible libnames
+      SET(args ${ARGN})
+      SET(newargs "")
+      SET(libnames_release "")
+      SET(libnames_debug "")
+
+      LIST(LENGTH args listCount)
+
+      IF("${libname}" STREQUAL "NAMES")
+        SET(append_rest 0)
+        LIST(APPEND args " ")
+
+        FOREACH(i RANGE ${listCount})
+          LIST(GET args ${i} val)
+
+          IF(append_rest)
+            LIST(APPEND newargs ${val})
+          ELSE(append_rest)
+            IF("${val}" STREQUAL "PATHS")
+              LIST(APPEND newargs ${val})
+              SET(append_rest 1)
+            ELSE("${val}" STREQUAL "PATHS")
+              LIST(APPEND libnames_release "${val}")
+              LIST(APPEND libnames_debug   "${val}${dgb_postfix}")
+            ENDIF("${val}" STREQUAL "PATHS")
+          ENDIF(append_rest)
+
+        ENDFOREACH(i)
+
+      ELSE("${libname}" STREQUAL "NAMES")
+
+        # just one name
+        LIST(APPEND libnames_release "${libname}")
+        LIST(APPEND libnames_debug   "${libname}${dgb_postfix}")
+
+        SET(newargs ${args})
+
+      ENDIF("${libname}" STREQUAL "NAMES")
+
+      # search the release lib
+      FIND_LIBRARY(${var_name}_RELEASE
+                   NAMES ${libnames_release}
+                   ${newargs}
+      )
+
+      # search the debug lib
+      FIND_LIBRARY(${var_name}_DEBUG
+                   NAMES ${libnames_debug}
+                   ${newargs}
+      )
+
+      IF(${var_name}_RELEASE AND ${var_name}_DEBUG)
+
+        # both libs found
+        SET(${var_name} optimized ${${var_name}_RELEASE}
+                        debug     ${${var_name}_DEBUG})
+
+      ELSE(${var_name}_RELEASE AND ${var_name}_DEBUG)
+
+        IF(${var_name}_RELEASE)
+
+          # only release found
+          SET(${var_name} ${${var_name}_RELEASE})
+
+        ELSE(${var_name}_RELEASE)
+
+          # only debug (or nothing) found
+          SET(${var_name} ${${var_name}_DEBUG})
+
+        ENDIF(${var_name}_RELEASE)
+       =

+      ENDIF(${var_name}_RELEASE AND ${var_name}_DEBUG)
+
+      MARK_AS_ADVANCED(${var_name}_RELEASE)
+      MARK_AS_ADVANCED(${var_name}_DEBUG)
+
+    ENDIF(NOT WIN32)
+
+  ENDIF(NOT "${win32_dbg_postfix_name}" STREQUAL "WIN32_DEBUG_POSTFIX")
+
+ENDMACRO(FIND_LIBRARY_WITH_DEBUG)
diff --git a/FindQCA2.cmake b/FindQCA2.cmake
new file mode 100644
index 0000000..e2d8f2a
--- /dev/null
+++ b/FindQCA2.cmake
@@ -0,0 +1,48 @@
+# - Try to find QCA2 (Qt Cryptography Architecture 2)
+# Once done this will define
+#
+#  QCA2_FOUND - system has QCA2
+#  QCA2_INCLUDE_DIR - the QCA2 include directory
+#  QCA2_LIBRARIES - the libraries needed to use QCA2
+#  QCA2_DEFINITIONS - Compiler switches required for using QCA2
+#
+# use pkg-config to get the directories and then use these values
+# in the FIND_PATH() and FIND_LIBRARY() calls
+
+# Copyright (c) 2006, Michael Larouche, <michael.larouche@kdemail.net>
+#
+# Redistribution and use is allowed according to the terms of the BSD lice=
nse.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+include(FindLibraryWithDebug)
+
+if (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES)
+
+  # in cache already
+  set(QCA2_FOUND TRUE)
+
+else (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES)
+
+
+  if (NOT WIN32)
+    find_package(PkgConfig)
+    pkg_check_modules(PC_QCA2 QUIET qca2)
+    set(QCA2_DEFINITIONS ${PC_QCA2_CFLAGS_OTHER})
+  endif (NOT WIN32)
+
+  find_library_with_debug(QCA2_LIBRARIES
+                  WIN32_DEBUG_POSTFIX d
+                  NAMES qca
+                  HINTS ${PC_QCA2_LIBDIR} ${PC_QCA2_LIBRARY_DIRS}
+                  )
+
+  find_path(QCA2_INCLUDE_DIR QtCrypto
+            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)
+
+endif (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES)

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic