kdesupport

Dario Freddi drf at kde.org
Fri Mar 5 12:56:57 CET 2010


SVN commit 1099280 by dafre:

CCMAIL: kde-buildsystem at kde.org

After some more swearing to get together all needed dependencies, move all checks inside polkit-qt as well and do not require pkgconfig any longer.
Also a small fix to FindPolkit.cmake
And in the end, finally clean up the very toplevel CMakeLists.txt as Alex requested in the first place :)



 M  +2 -17     CMakeLists.txt  
 M  +1 -1      polkit-qt-1/cmake/modules/FindPolkit.cmake  
 M  +79 -89    polkit-qt/CMakeLists.txt  
 A             polkit-qt/cmake/modules/FindDBus.cmake  
 A             polkit-qt/cmake/modules/FindGLib2.cmake  
 A             polkit-qt/cmake/modules/FindPolicykit.cmake  


--- trunk/kdesupport/CMakeLists.txt #1099279:1099280
@@ -27,27 +27,12 @@
 #macro_optional_add_subdirectory(decibel)
 macro_optional_add_subdirectory(taglib-extras)
 macro_optional_add_subdirectory(attica)
+macro_optional_add_subdirectory(polkit-qt)
+macro_optional_add_subdirectory(polkit-qt-1)
 
 # svn:external from oscaf.sf.net for developer convenience
 macro_optional_add_subdirectory(shared-desktop-ontologies)
 
-if (UNIX)
-   set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/polkit-qt/cmake/modules" ${CMAKE_MODULE_PATH} )
-   include (FindPkgConfig)
-   pkg_check_modules (POLKIT polkit>=0.8)
-   pkg_check_modules (POLKITDBUS polkit-dbus>=0.8)
-   pkg_check_modules (POLKITGRANT polkit-grant>=0.8)
-   if(POLKITDBUS_FOUND AND POLKIT_FOUND AND POLKITGRANT_FOUND)
-      macro_optional_add_subdirectory(polkit-qt)
-   endif(POLKITDBUS_FOUND AND POLKIT_FOUND AND POLKITGRANT_FOUND)
-
-   set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/polkit-qt-1/cmake/modules" ${CMAKE_MODULE_PATH} )
-   pkg_check_modules (POLKIT-1 polkit-gobject-1>=0.95)
-   pkg_check_modules (POLKIT-1_AGENT polkit-agent-1>=0.95)
-   if(POLKIT-1_FOUND AND POLKIT-1_AGENT_FOUND)
-      macro_optional_add_subdirectory(polkit-qt-1)
-   endif(POLKIT-1_FOUND AND POLKIT-1_AGENT_FOUND)
-endif (UNIX)
 if (WIN32)
    add_subdirectory(kdewin)
 endif (WIN32)
--- trunk/kdesupport/polkit-qt-1/cmake/modules/FindPolkit.cmake #1099279:1099280
@@ -65,7 +65,7 @@
 # handle the QUIETLY and REQUIRED arguments and set POLKIT_FOUND to TRUE if
 # all listed variables are TRUE
 find_package_handle_standard_args(Polkit DEFAULT_MSG POLKIT_LIBRARY POLKIT_AGENT_LIBRARY
-                                                     POLKIT_INCLUDE_DIRS POLKIT_AGENT_INCLUDE_DIRS GLIB2_FOUND)
+                                                     _POLKIT_INCLUDE_DIR _POLKIT_AGENT_INCLUDE_DIR GLIB2_FOUND)
 
 mark_as_advanced(POLKIT_INCLUDE_DIRS POLKIT_AGENT_INCLUDE_DIRS POLKIT_LIBRARY POLKIT_AGENT_LIBRARY GLIB_INCLUDE_DIR)
 
--- trunk/kdesupport/polkit-qt/CMakeLists.txt #1099279:1099280
@@ -10,107 +10,97 @@
 find_package(Automoc4 REQUIRED)
 
 include (${QT_USE_FILE})
-include (FindPkgConfig)
 include (InstallSettings)
+find_package(Policykit)
 
-pkg_check_modules (POLKIT REQUIRED polkit>=0.8)
-pkg_check_modules (POLKITDBUS REQUIRED polkit-dbus>=0.8)
-pkg_check_modules (POLKITGRANT REQUIRED polkit-grant>=0.8)
+if (POLICYKIT_FOUND)
+    include_directories(
+          ${CMAKE_CURRENT_BINARY_DIR}
+          ${POLICYKIT_INCLUDE_DIRS}
+          ${CMAKE_CURRENT_SOURCE_DIR}
+          ${CMAKE_CURRENT_SOURCE_DIR}/includes
+    )
 
-MESSAGE(STATUS " ${POLKIT_INCLUDE_DIRS} ===========")
+    set(CMAKE_MAJOR_POLKITQT_VERSION 0 CACHE INT "PolkitQt's major version number" FORCE)
+    set(CMAKE_MINOR_POLKITQT_VERSION 9 CACHE INT "PolkitQt's minor version number" FORCE)
+    set(CMAKE_RELEASE_POLKITQT_VERSION 3 CACHE INT "PolkitQt's release version number" FORCE)
+    set(CMAKE_POLKITQT_VERSION_STRING "${CMAKE_MAJOR_POLKITQT_VERSION}.${CMAKE_MINOR_POLKITQT_VERSION}.${CMAKE_RELEASE_POLKITQT_VERSION}" CACHE STRING "PolkitQt version string" FORCE)
 
-include_directories(
-      ${CMAKE_CURRENT_BINARY_DIR}
-      ${POLKIT_INCLUDE_DIRS}
-      ${POLKITDBUS_INCLUDE_DIRS}
-      ${CMAKE_CURRENT_SOURCE_DIR}
-      ${CMAKE_CURRENT_SOURCE_DIR}/includes
-)
+    configure_file(polkitqtversion.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkitqtversion.h)
 
-link_directories(
-	${POLKIT_LIBRARY_DIRS}
-)
+    set(polkit_qt_core_SRCS
+        auth.cpp
+        context.cpp
+    )
 
-set(CMAKE_MAJOR_POLKITQT_VERSION 0 CACHE INT "PolkitQt's major version number" FORCE)
-set(CMAKE_MINOR_POLKITQT_VERSION 9 CACHE INT "PolkitQt's minor version number" FORCE)
-set(CMAKE_RELEASE_POLKITQT_VERSION 3 CACHE INT "PolkitQt's release version number" FORCE)
-set(CMAKE_POLKITQT_VERSION_STRING "${CMAKE_MAJOR_POLKITQT_VERSION}.${CMAKE_MINOR_POLKITQT_VERSION}.${CMAKE_RELEASE_POLKITQT_VERSION}" CACHE STRING "PolkitQt version string" FORCE)
+    set(polkit_qt_gui_SRCS
+        action.cpp
+        actionbutton.cpp
+        actionbuttons.cpp
+    )
 
-configure_file(polkitqtversion.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkitqtversion.h)
+    automoc4_add_library(polkit-qt-core SHARED ${polkit_qt_core_SRCS})
+    automoc4_add_library(polkit-qt-gui SHARED ${polkit_qt_gui_SRCS})
 
-set(polkit_qt_core_SRCS
-    auth.cpp
-    context.cpp
-)
+    target_link_libraries(polkit-qt-core
+        ${QT_QTCORE_LIBRARY}
+        ${QT_QTDBUS_LIBRARY}
+        ${QT_QTXML_LIBRARY}
+        ${POLICYKIT_LIBRARIES}
+    )
 
-set(polkit_qt_gui_SRCS
-    action.cpp
-    actionbutton.cpp
-    actionbuttons.cpp
-)
+    target_link_libraries(polkit-qt-gui
+        polkit-qt-core
+        ${QT_QTCORE_LIBRARY}
+        ${QT_QTGUI_LIBRARY}
+        ${QT_QTDBUS_LIBRARY}
+        ${POLICYKIT_LIBRARIES}
+    )
 
-automoc4_add_library(polkit-qt-core SHARED ${polkit_qt_core_SRCS})
-automoc4_add_library(polkit-qt-gui SHARED ${polkit_qt_gui_SRCS})
+    set_target_properties(polkit-qt-core PROPERTIES VERSION ${CMAKE_POLKITQT_VERSION_STRING}
+                                    SOVERSION ${CMAKE_MAJOR_POLKITQT_VERSION}
+                                    DEFINE_SYMBOL MAKE_POLKIT_QT_LIB
+                          )
+                          
+    set_target_properties(polkit-qt-gui PROPERTIES VERSION ${CMAKE_POLKITQT_VERSION_STRING}
+                                    SOVERSION ${CMAKE_MAJOR_POLKITQT_VERSION}
+                                    DEFINE_SYMBOL MAKE_POLKIT_QT_LIB
+                          )
+                          
+    install(TARGETS polkit-qt-core ${INSTALL_TARGETS_DEFAULT_ARGS})
+    install(TARGETS polkit-qt-gui ${INSTALL_TARGETS_DEFAULT_ARGS})
 
-target_link_libraries(polkit-qt-core
- 	${POLKITDBUS_LIBRARIES}
- 	${POLKITGRANT_LIBRARIES}
-	${QT_QTCORE_LIBRARY}
-	${QT_QTDBUS_LIBRARY}
-	${QT_QTXML_LIBRARY}
-	${POLKIT_LIBRARIES}
-)
+    install(FILES
+        action.h
+        auth.h
+        context.h
+        actionbutton.h
+        actionbuttons.h
+      export.h
+      ${CMAKE_CURRENT_BINARY_DIR}/polkitqtversion.h
+        
+      includes/Action
+        includes/Auth
+        includes/Context
+        includes/ActionButton
+        includes/ActionButtons
+        DESTINATION
+        ${INCLUDE_INSTALL_DIR}/PolicyKit/polkit-qt COMPONENT Devel)
 
-target_link_libraries(polkit-qt-gui
-	polkit-qt-core
- 	${POLKITDBUS_LIBRARIES}
- 	${POLKITGRANT_LIBRARIES}
-	${QT_QTCORE_LIBRARY}
-	${QT_QTGUI_LIBRARY}
-	${QT_QTDBUS_LIBRARY}
-	${POLKIT_LIBRARIES}
-)
+    # Pkgconfig
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/polkit-qt.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt.pc @ONLY)
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/polkit-qt-core.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-core.pc @ONLY)
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-core.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/polkit-qt-gui.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-gui.pc @ONLY)
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-gui.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
 
-set_target_properties(polkit-qt-core PROPERTIES VERSION ${CMAKE_POLKITQT_VERSION_STRING}
-                                SOVERSION ${CMAKE_MAJOR_POLKITQT_VERSION}
-                                DEFINE_SYMBOL MAKE_POLKIT_QT_LIB
-                      )
-                      
-set_target_properties(polkit-qt-gui PROPERTIES VERSION ${CMAKE_POLKITQT_VERSION_STRING}
-                                SOVERSION ${CMAKE_MAJOR_POLKITQT_VERSION}
-                                DEFINE_SYMBOL MAKE_POLKIT_QT_LIB
-                      )
-                      
-install(TARGETS polkit-qt-core ${INSTALL_TARGETS_DEFAULT_ARGS})
-install(TARGETS polkit-qt-gui ${INSTALL_TARGETS_DEFAULT_ARGS})
+    if (BUILD_EXAMPLES)
+        add_subdirectory(examples)
+    endif (BUILD_EXAMPLES)
 
-install(FILES
-	action.h
-	auth.h
-	context.h
-	actionbutton.h
-	actionbuttons.h
-  export.h
-  ${CMAKE_CURRENT_BINARY_DIR}/polkitqtversion.h
-	
-  includes/Action
-	includes/Auth
-	includes/Context
-	includes/ActionButton
-	includes/ActionButtons
-	DESTINATION
-	${INCLUDE_INSTALL_DIR}/PolicyKit/polkit-qt COMPONENT Devel)
+    add_subdirectory(cmake)
 
-# Pkgconfig
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/polkit-qt.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt.pc @ONLY)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/polkit-qt-core.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-core.pc @ONLY)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-core.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/polkit-qt-gui.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-gui.pc @ONLY)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-qt-gui.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
-
-if (BUILD_EXAMPLES)
-    add_subdirectory(examples)
-endif (BUILD_EXAMPLES)
-
-add_subdirectory(cmake)
+else(POLICYKIT_FOUND)
+    message(STATUS "PolicyKit was not found on your system. Skipping compilation of polkit-qt")
+endif(POLICYKIT_FOUND)


More information about the Kde-buildsystem mailing list