[plasma-mobile] /: Rewrite and use FindKActivities.cmake.

Michael Jansen kde at michael-jansen.biz
Mon Mar 26 20:44:00 UTC 2012


Git commit 83994459634aba64f57b29ac9e666b37ae28dfad by Michael Jansen.
Committed on 26/03/2012 at 22:38.
Pushed by mjansen into branch 'master'.

Rewrite and use FindKActivities.cmake.

I wonder if the NO_MODULE parameter is used correctly in the find_package_handle_standard_args
parameter. I could not really understand the documentation for that one. But it works.

CCMAIL: kde-buildsystem at kde.org
CCMAIL: plasma-devel at kde.org

M  +3    -1    CMakeLists.txt
M  +27   -33   cmake/modules/FindKActivities.cmake

http://commits.kde.org/plasma-mobile/83994459634aba64f57b29ac9e666b37ae28dfad

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a70d8a6..4245298 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,8 +1,10 @@
 project(plasma-mobile)
 cmake_minimum_required (VERSION 2.8)
 
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
+
 find_package(KDE4 REQUIRED)
-find_package(KActivities REQUIRED)
+find_package(KActivities 6.0.0 REQUIRED)
 
 include(KDE4Defaults)
 
diff --git a/cmake/modules/FindKActivities.cmake b/cmake/modules/FindKActivities.cmake
index 1878147..c74a38f 100644
--- a/cmake/modules/FindKActivities.cmake
+++ b/cmake/modules/FindKActivities.cmake
@@ -11,36 +11,30 @@
 # Redistribution and use is allowed according to the terms of the BSD license.
 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
 
-if (KACTIVITIES_INCLUDE_DIR AND KACTIVITIES_LIBS)
-   # Already in cache, be silent
-   # This probably means that libKActivities is a part of the current
-   # build or that this script was already invoked
-
-   set(KActivities_FIND_QUIETLY TRUE)
-   message("KActivities variables already set")
-endif (KACTIVITIES_INCLUDE_DIR AND KACTIVITIES_LIBS)
-
-if (NOT KActivities_FIND_QUIETLY)
-   message("Searching for KActivities")
-
-   find_path(KACTIVITIES_INCLUDE_DIR NAMES kactivities/consumer.h
-      PATHS
-      ${KDE4_INCLUDE_DIR}
-      ${INCLUDE_INSTALL_DIR}
-   )
-
-   find_library(KACTIVITIES_LIBS NAMES kactivities
-      PATHS
-      ${KDE4_LIB_DIR}
-      ${LIB_INSTALL_DIR}
-   )
-
-   include(FindPackageHandleStandardArgs)
-   FIND_PACKAGE_HANDLE_STANDARD_ARGS(i
-       KActivities DEFAULT_MSG KACTIVITIES_LIBS KACTIVITIES_INCLUDE_DIR )
-
-   mark_as_advanced(KACTIVITIES_INCLUDE_DIR KACTIVITIES_LIBS)
-endif (NOT KActivities_FIND_QUIETLY)
-
-message("-- Found KActivities include dir: ${KACTIVITIES_INCLUDE_DIR}")
-message("-- Found KActivities lib: ${KACTIVITIES_LIBS}")
+# Kinda stupid those are not set to QUIET and REQUIRED so i could just forward them.
+set(_find_package_args)
+
+if(${KActivities_FIND_QUIET})
+    list(APPEND _find_package_args QUIET)
+endif()
+
+if(${KActivities_FIND_EXACT})
+    list(APPEND _find_package_args EXACT)
+endif()
+
+if(${KActivities_FIND_REQUIRED})
+    list(APPEND _find_package_args REQUIRED)
+endif()
+
+find_package(
+    KActivities
+    ${KActivities_FIND_VERSION}
+    ${_find_package_args}
+    NO_MODULE)
+
+find_package_handle_standard_args(
+    KActivities
+    REQUIRED_VARS KACTIVITIES_INCLUDE_DIRS
+    VERSION_VAR   COFIG_MODE)
+
+



More information about the Kde-buildsystem mailing list