cmake: Fix build with Qt 5.11
[quassel.git] / cmake / FindQCA2-QT5.cmake
index 0d28590..6b1e0a9 100644 (file)
 # Redistribution and use is allowed according to the terms of the BSD license.
 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
 
+include(FindPackageHandleStandardArgs)
+
+find_package(Qca-qt5 QUIET)
+if(Qca-qt5_FOUND)
+
+  set(QCA2-QT5_INCLUDE_DIR ${CMAKE_PREFIX_PATH}/include)#just to have any value as the real include dir is imported by linking to qca-qt5
+  set(QCA2-QT5_LIBRARIES qca-qt5)
+
+  find_package_handle_standard_args(QCA2-QT5 DEFAULT_MSG QCA2-QT5_LIBRARIES QCA2-QT5_INCLUDE_DIR)
+
+  mark_as_advanced(QCA2-QT5_INCLUDE_DIR QCA2-QT5_LIBRARIES)
+else()
+
 include(FindLibraryWithDebug)
 
 if (QCA2-QT5_INCLUDE_DIR AND QCA2-QT5_LIBRARIES)
@@ -21,14 +34,14 @@ if (QCA2-QT5_INCLUDE_DIR AND QCA2-QT5_LIBRARIES)
   # in cache already
   set(QCA2-QT5_FOUND TRUE)
 
-else (QCA2-QT5_INCLUDE_DIR AND QCA2-QT5_LIBRARIES)
+else()
 
 
   if (NOT WIN32)
     find_package(PkgConfig)
     pkg_check_modules(PC_QCA2-QT5 QUIET qca2-qt5)
     set(QCA2-QT5_DEFINITIONS ${PC_QCA2-QT5_CFLAGS_OTHER})
-  endif (NOT WIN32)
+  endif()
 
   find_library_with_debug(QCA2-QT5_LIBRARIES
                   WIN32_DEBUG_POSTFIX d
@@ -40,9 +53,9 @@ else (QCA2-QT5_INCLUDE_DIR AND QCA2-QT5_LIBRARIES)
             HINTS ${PC_QCA2-QT5_INCLUDEDIR} ${PC_QCA2-QT5_INCLUDE_DIRS}
             PATH_SUFFIXES QtCrypto)
 
-  include(FindPackageHandleStandardArgs)
   find_package_handle_standard_args(QCA2-QT5 DEFAULT_MSG QCA2-QT5_LIBRARIES QCA2-QT5_INCLUDE_DIR)
 
   mark_as_advanced(QCA2-QT5_INCLUDE_DIR QCA2-QT5_LIBRARIES)
 
-endif (QCA2-QT5_INCLUDE_DIR AND QCA2-QT5_LIBRARIES)
+endif()
+endif()