kdesupport/polkit-qt-1

Dario Freddi drf at kde.org
Fri Mar 5 12:24:51 CET 2010


SVN commit 1099277 by dafre:

CCMAIL: kde-buildsystem at kde.org

Add proper checks for polkit when pkgconfig is not present, even if this means throwing in glib2's checks as well. Also move the checks to the toplevel
CMakeLists.txt

Signed-off-by: Dario Freddi <drf at kde.org>

 M  +85 -84    CMakeLists.txt  
 A             cmake/modules/FindGLib2.cmake  
 A             cmake/modules/FindPolkit.cmake  


--- trunk/kdesupport/polkit-qt-1/CMakeLists.txt #1099276:1099277
@@ -1,111 +1,112 @@
 ## Polkit Qt Library
-project("Polkit-qt-1")
+project("PolkitQt-1")
 
 cmake_minimum_required(VERSION 2.6.0)
 
-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})
 
 set(QT_MIN_VERSION "4.4.0")
 
 find_package(Qt4 REQUIRED)
 find_package(Automoc4 REQUIRED)
+find_package(Polkit)
 
-include (${QT_USE_FILE})
-include (InstallSettings)
-include (FindPkgConfig)
+if(POLKIT_FOUND)
+    include (${QT_USE_FILE})
+    include (InstallSettings)
 
-pkg_check_modules (POLKIT-1 REQUIRED polkit-gobject-1>=0.95)
-pkg_check_modules (POLKIT-1_AGENT REQUIRED polkit-agent-1>=0.95)
+    include_directories(
+        ${CMAKE_CURRENT_BINARY_DIR}
+        ${POLKIT_INCLUDE_DIRS}
+        ${POLKIT_AGENT_INCLUDE_DIRS}
+        ${CMAKE_CURRENT_SOURCE_DIR}
+        ${CMAKE_CURRENT_SOURCE_DIR}/core
+        ${CMAKE_CURRENT_SOURCE_DIR}/includes
+        ${QT_QTXML_INCLUDE_DIR}
+    )
 
-message(STATUS " ${POLKIT-1_INCLUDE_DIRS} ===========")
+    set(CMAKE_MAJOR_POLKITQT-1_VERSION 0 CACHE INT "PolkitQt-1's major version number" FORCE)
+    set(CMAKE_MINOR_POLKITQT-1_VERSION 95 CACHE INT "PolkitQt-1's minor version number" FORCE)
+    set(CMAKE_RELEASE_POLKITQT-1_VERSION 2 CACHE INT "PolkitQt-1's release version number" FORCE)
+    set(CMAKE_POLKITQT-1_VERSION_STRING
+        "${CMAKE_MAJOR_POLKITQT-1_VERSION}.${CMAKE_MINOR_POLKITQT-1_VERSION}.${CMAKE_RELEASE_POLKITQT-1_VERSION}")
 
-include_directories(
-    ${CMAKE_CURRENT_BINARY_DIR}
-    ${POLKIT-1_INCLUDE_DIRS}
-    ${POLKIT-1_AGENT_INCLUDE_DIRS}
-    ${CMAKE_CURRENT_SOURCE_DIR}
-    ${CMAKE_CURRENT_SOURCE_DIR}/core
-    ${CMAKE_CURRENT_SOURCE_DIR}/includes
-    ${QT_QTXML_INCLUDE_DIR}
-)
+    configure_file(polkitqt1-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkitqt1-version.h)
 
-set(CMAKE_MAJOR_POLKITQT-1_VERSION 0 CACHE INT "PolkitQt-1's major version number" FORCE)
-set(CMAKE_MINOR_POLKITQT-1_VERSION 95 CACHE INT "PolkitQt-1's minor version number" FORCE)
-set(CMAKE_RELEASE_POLKITQT-1_VERSION 2 CACHE INT "PolkitQt-1's release version number" FORCE)
-set(CMAKE_POLKITQT-1_VERSION_STRING "${CMAKE_MAJOR_POLKITQT-1_VERSION}.${CMAKE_MINOR_POLKITQT-1_VERSION}.${CMAKE_RELEASE_POLKITQT-1_VERSION}")
+    install(FILES
+        gui/polkitqt1-gui-action.h
+        gui/polkitqt1-gui-actionbutton.h
+        gui/polkitqt1-gui-actionbuttons.h
 
-configure_file(polkitqt1-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkitqt1-version.h)
+        core/polkitqt1-authority.h
+        core/polkitqt1-details.h
+        core/polkitqt1-identity.h
+        core/polkitqt1-subject.h
+        core/polkitqt1-temporaryauthorization.h
+        core/polkitqt1-actiondescription.h
 
-install(FILES
-    gui/polkitqt1-gui-action.h
-    gui/polkitqt1-gui-actionbutton.h
-    gui/polkitqt1-gui-actionbuttons.h
+        agent/polkitqt1-agent-listener.h
+        agent/polkitqt1-agent-session.h
 
-    core/polkitqt1-authority.h
-    core/polkitqt1-details.h
-    core/polkitqt1-identity.h
-    core/polkitqt1-subject.h
-    core/polkitqt1-temporaryauthorization.h
-    core/polkitqt1-actiondescription.h
+        ${CMAKE_CURRENT_BINARY_DIR}/polkitqt1-version.h
+        polkitqt1-export.h
 
-    agent/polkitqt1-agent-listener.h
-    agent/polkitqt1-agent-session.h
+        DESTINATION
+        ${INCLUDE_INSTALL_DIR}/polkit-qt-1 COMPONENT Devel)
 
-    ${CMAKE_CURRENT_BINARY_DIR}/polkitqt1-version.h
-    polkitqt1-export.h
+    install(FILES
+        includes/PolkitQt1/Authority
+        includes/PolkitQt1/Details
+        includes/PolkitQt1/Identity
+        includes/PolkitQt1/Subject
+        includes/PolkitQt1/TemporaryAuthorization
+        includes/PolkitQt1/ActionDescription
+        DESTINATION
+        ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitQt1 COMPONENT Devel)
 
-    DESTINATION
-    ${INCLUDE_INSTALL_DIR}/polkit-qt-1 COMPONENT Devel)
+    install(FILES
+        includes/PolkitQt1/Gui/Action
+        includes/PolkitQt1/Gui/ActionButton
+        includes/PolkitQt1/Gui/ActionButtons
+        DESTINATION
+        ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitQt1/Gui COMPONENT Devel)
 
-install(FILES
-    includes/PolkitQt1/Authority
-    includes/PolkitQt1/Details
-    includes/PolkitQt1/Identity
-    includes/PolkitQt1/Subject
-    includes/PolkitQt1/TemporaryAuthorization
-    includes/PolkitQt1/ActionDescription
-    DESTINATION
-    ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitQt1 COMPONENT Devel)
+    install(FILES
+        includes/PolkitQt1/Agent/Listener
+        includes/PolkitQt1/Agent/Session
+        DESTINATION
+        ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitQt1/Agent COMPONENT Devel)
 
-install(FILES
-    includes/PolkitQt1/Gui/Action
-    includes/PolkitQt1/Gui/ActionButton
-    includes/PolkitQt1/Gui/ActionButtons
-    DESTINATION
-    ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitQt1/Gui COMPONENT Devel)
 
-install(FILES
-    includes/PolkitQt1/Agent/Listener
-    includes/PolkitQt1/Agent/Session
-    DESTINATION
-    ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitQt1/Agent COMPONENT Devel)
+    if(NOT WIN32)
+        # Pkgconfig
+        configure_file(${CMAKE_CURRENT_SOURCE_DIR}/polkit-qt-1.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-1.pc @ONLY)
+        install(FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-1.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
+        configure_file(${CMAKE_CURRENT_SOURCE_DIR}/polkit-qt-core-1.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-core-1.pc
+                       @ONLY)
+        install(FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-core-1.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
+        configure_file(${CMAKE_CURRENT_SOURCE_DIR}/polkit-qt-gui-1.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-gui-1.pc @ONLY)
+        install(FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-gui-1.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
+        configure_file(${CMAKE_CURRENT_SOURCE_DIR}/polkit-qt-agent-1.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-agent-1.pc
+                       @ONLY)
+        install(FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-agent-1.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
+    endif(NOT WIN32)
 
+    option(BUILD_EXAMPLES "Builds a set of examples for polkit-qt-1" OFF)
+    if (BUILD_EXAMPLES)
+        add_subdirectory(examples)
+    endif (BUILD_EXAMPLES)
 
-if(NOT WIN32)
-# Pkgconfig
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/polkit-qt-1.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-1.pc @ONLY)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-1.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/polkit-qt-core-1.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-core-1.pc @ONLY)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-core-1.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/polkit-qt-gui-1.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-gui-1.pc @ONLY)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-gui-1.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/polkit-qt-agent-1.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-agent-1.pc @ONLY)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-agent-1.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
-endif(NOT WIN32)
+    add_subdirectory(cmake)
 
-option(BUILD_EXAMPLES "Builds a set of examples for polkit-qt-1" OFF)
-if (BUILD_EXAMPLES)
-    add_subdirectory(examples)
-endif (BUILD_EXAMPLES)
+    option(BUILD_TEST "Builds unit tests for polkit-qt-1" OFF)
+    if (BUILD_TEST)
+        add_subdirectory(test)
+    endif (BUILD_TEST)
 
-add_subdirectory(cmake)
-
-option(BUILD_TEST "Builds unit tests for polkit-qt-1" OFF)
-if (BUILD_TEST)
-    add_subdirectory(test)
-endif (BUILD_TEST)
-
-add_subdirectory(core)
-add_subdirectory(gui)
-add_subdirectory(agent)
-
+    add_subdirectory(core)
+    add_subdirectory(gui)
+    add_subdirectory(agent)
+else(POLKIT_FOUND)
+    message(STATUS "polkit-1 was not found on this system. Skipping polkit-qt-1 compilation")
+endif(POLKIT_FOUND)


More information about the Kde-buildsystem mailing list