Hi back, first attempt of doing things right. Please review. My only doubt is about the new KDE4_KAUTH_POLICY_GEN_EXECUTABLE: is it valid also while building kdelibs or should I add another if _kdeBootstrap to kde4_auth_add_actions?
In data giovedì 03 settembre 2009 20:50:28, Alexander Neundorf ha scritto:
: > On Thursday 03 September 2009, Dario Freddi wrote:
> > In data giovedì 03 settembre 2009 20:02:38, Alexander Neundorf ha scritto:
> > > Now that it is part of kdecore the searching for the installed files is
> > > not really necessary anymore.
> > > kauth/dbus_service.stub and kauth/dbus_policy.stub will be installed to
> > > ${DATA_INSTALL_DIR}, which is ${KDE4_DATA_INSTALL_DIR} for everybody
> > > outside kdelibs.
> >
> > Which brings me to a problem. Some stuff in KDELibs actually need those
> > variables. For the time being, I worked around that this way:
> >
> > include(MacroKAuth)
> >
> > set( KDE4_KAUTH_DBUS_POLICY_STUB
> > ${CMAKE_SOURCE_DIR}/kdecore/auth/backends/dbus/dbus_policy.stub)
> > set( KDE4_KAUTH_DBUS_SERVICE_STUB
> > ${CMAKE_SOURCE_DIR}/kdecore/auth/backends/dbus/dbus_service.stub)
> > set( KDE4_KAUTH_POLICY_GEN kauth-policy-gen)
> >
> > But it's damned ugly. Also, consider that these three variables will just
> > be used internally in KAuth macros. Given that, what is the ultimate
> > right way?
>
> Inside the macros you could check for _kdeBootStrapping (set in
> FindKDE4Internal.cmake if kdelibs itself is being built), or for
> kdelibs_SOURCE_DIR (is set if this CMakeLists.txt is somewhere below a
> project(kdelibs) call) and then adapt the directory accordingly.
>
> > > So you can basically just use
> > > ${KDE4_DATA_INSTALL_DIR}/kauth/dbus_service.stub and
> > > ${KDE4_DATA_INSTALL_DIR}/kauth/dbus_policy.stub directly in the macros
> > > (we also don't check for the existence of every single installed other
> > > file of kdelibs, like e.g. every single header).
> > > If you really want to be sure, you can use
> > > find_file(_kauth_really_exists
> > > NAMES kauth/dbus_policy.stub
> > > PATHS ${KDE4_DATA_INSTALL_DIR}
> > > NO_DEFAULT_PATH)
> > > or
> > > if(EXISTS ${KDE4_DATA_INSTALL_DIR}/kauth/dbus_policy.stub)
> > > to check whether the file really does exist (but it shouldn't be
> > > necessary). The proper way to check that would be to increase the
> > > kdelibs version number and require the appropriate version in the KDE
> > > modules needing kauth.
> >
> > Well, KAuth will be in from 4.4, so I guess that's doable
>
> I mean, right now the version number of kdelibs could be increased.
>
> > > The executable kauth-policy-gen should be handled like e.g. meinproc4.
> > > This means when installing it, it should be added to
> > > the "export-set" "kdelibsToolsTargets", which is a set of targets which
> > > are "exported" into a special cmake file which is installed when
> > > installing kdelibs (see bottom of kdelibs/CMakeLists.txt). Then later
> > > on in FindKDE4Internal.cmake the LOCATION property of the then imported
> > > target should be used to set KDE4_KDE4_KAUTH_POLICY_GEN (which should
> > > be renamed to KDE4_KAUTH_POLICY_GEN_EXECUTABLE).
> >
> > Ok, I will do that
> >
> > > The file MacroKAuth.cmake can then be removed. To give people a hint
> > > why their build suddenly breaks if the still have include(MacroKAuth)
> > > somewhere, you can replace the contents of MacroKAuth.cmake for some
> > > time with just:
> > >
> > > message(FATAL_ERROR "Don't include(MacroKAuth) anymore, it's now
> > > included in find_package(KDE4)")
> >
> > Nice, will do as well :)
> >
> > /me is really happy to learn this stuff for cmake, thanks Alexander :)
> >
> > P.S.: I would paste this mail, a bit refactored, on Techbase. Can be
> > damned useful
>
> Would or will ?
> Which part exactly ?
> The stuff about exporting/importing should be in the "cmake news with 4.2"
> page on techbase.
>
> Alex
>
--
-------------------
Dario Freddi
KDE Developer
GPG Key Signature: 511A9A3B
Index: cmake/modules/FindPolkitQt.cmake
===================================================================
--- cmake/modules/FindPolkitQt.cmake (revisione 1020053)
+++ cmake/modules/FindPolkitQt.cmake (copia locale)
@@ -19,74 +19,63 @@
set(POLKITQT_FIND_QUIETLY TRUE)
endif (POLKITQT_INCLUDE_DIR AND POLKITQT_LIB)
-include(FindPkgConfig)
-
if (NOT POLKITQT_MIN_VERSION)
set(POLKITQT_MIN_VERSION "0.9.0")
endif (NOT POLKITQT_MIN_VERSION)
-pkg_search_module( POLKITQT polkit-qt )
+if (NOT WIN32)
+ # use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ find_package(PkgConfig)
+ pkg_check_modules(PC_POLKITQT QUIET polkit-qt)
+ set(POLKITQT_DEFINITIONS ${PC_POLKITQT_CFLAGS_OTHER})
+endif (NOT WIN32)
-if (POLKITQT_FOUND)
- if (POLKITQT_VERSION VERSION_LESS POLKITQT_MIN_VERSION)
- message(STATUS "Found Polkit-Qt release < ${POLKITQT_MIN_VERSION}")
- message(STATUS "You need Polkit-Qt version ${POLKITQT_MIN_VERSION} or newer to compile this component")
- set(POLKITQT_FOUND FALSE)
- return()
- else (POLKITQT_VERSION VERSION_LESS POLKITQT_MIN_VERSION)
- message(STATUS "Found Polkit-Qt release >= ${POLKITQT_MIN_VERSION}")
- if ( NOT POLKITQT_PREFIX STREQUAL CMAKE_INSTALL_PREFIX )
- message("WARNING: Installation prefix does not match PolicyKit install prefixes. You probably will need to move files installed "
- "in POLICY_FILES_INSTALL_DIR and by dbus_add_activation_system_service to the ${POLKITQT_PREFIX} prefix")
- endif (NOT POLKITQT_PREFIX STREQUAL CMAKE_INSTALL_PREFIX)
- endif (POLKITQT_VERSION VERSION_LESS POLKITQT_MIN_VERSION)
-else (POLKITQT_FOUND)
- set(POLKITQT_FOUND FALSE)
- message(STATUS "Cannot find Polkit-Qt library!")
- return()
-endif (POLKITQT_FOUND)
-
-
-# find_path( POLKITQT_INCLUDE_DIR PolicyKit/policykit-qt/Polkit-qt )
find_path( POLKITQT_INCLUDE_DIR
- NAMES PolicyKit/polkit-qt/
- HINTS ${POLKITQT_INCLUDEDIR}
+ NAMES PolicyKit/polkit-qt/auth.h
+ HINTS ${PC_POLKITQT_INCLUDEDIR}
)
find_library( POLKITQT_CORE_LIBRARY
NAMES polkit-qt-core
- HINTS ${POLKITQT_LIBDIR}
+ HINTS ${PC_POLKITQT_LIBDIR}
)
find_library( POLKITQT_GUI_LIBRARY
NAMES polkit-qt-gui
- HINTS ${POLKITQT_LIBDIR}
+ HINTS ${PC_POLKITQT_LIBDIR}
)
+find_library( POLKITQT_LIBRARIES
+ NAMES polkit-qt-gui polkit-qt-core
+ HINTS ${PC_POLKITQT_LIBDIR}
+)
-if (POLKITQT_INCLUDE_DIR AND POLKITQT_CORE_LIBRARY AND POLKITQT_GUI_LIBRARY)
- set(POLKITQT_FOUND TRUE)
-else (POLKITQT_INCLUDE_DIR AND POLKITQT_CORE_LIBRARY AND POLKITQT_GUI_LIBRARY)
- set(POLKITQT_FOUND FALSE)
-endif (POLKITQT_INCLUDE_DIR AND POLKITQT_CORE_LIBRARY AND POLKITQT_GUI_LIBRARY)
+#It really looks like find_path is not working, this one at least makes things work
+set(POLKITQT_INCLUDE_DIR ${PC_POLKITQT_INCLUDEDIR}/PolicyKit/polkit-qt ${PC_POLKITQT_INCLUDEDIR}/PolicyKit/)
-set(POLKITQT_LIBRARIES ${POLKITQT_CORE_LIBRARY} ${POLKITQT_GUI_LIBRARY})
+include(FindPackageHandleStandardArgs)
-set(POLKITQT_INCLUDE_DIR ${POLKITQT_INCLUDE_DIR}/PolicyKit/polkit-qt ${POLKITQT_INCLUDE_DIR}/PolicyKit/)
+# handle the QUIETLY and REQUIRED arguments and set POLKIQT_FOUND to TRUE if
+# all listed variables are TRUE
+find_package_handle_standard_args(PolkitQt DEFAULT_MSG POLKITQT_LIBRARIES POLKITQT_INCLUDE_DIR)
-#if (POLKITQT_PREFIX != ${CMAKE_INSTALL_PREFIX})
-#message("Warning: Move polkit files to /usr prefix")
-#endif()
-set(POLICY_FILES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/PolicyKit/policy/)
+mark_as_advanced(POLKITQT_INCLUDE_DIR POLKITQT_CORE_LIBRARY POLKITQT_GUI_LIBRARY POLKITQT_LIBRARIES)
if (POLKITQT_FOUND)
- if (NOT POLKITQT_FIND_QUIETLY)
- message(STATUS "Found Polkit-Qt: ${POLKITQT_LIBRARIES}")
- endif (NOT POLKITQT_FIND_QUIETLY)
-else (POLKITQT_FOUND)
- if (POLKITQT_FIND_REQUIRED)
- message(FATAL_ERROR "Could NOT find Polkit-Qt")
- endif (POLKITQT_FIND_REQUIRED)
+ if (POLKITQT_VERSION VERSION_LESS POLKITQT_MIN_VERSION)
+ message(STATUS "Found Polkit-Qt release < ${POLKITQT_MIN_VERSION}")
+ message(STATUS "You need Polkit-Qt version ${POLKITQT_MIN_VERSION} or newer to compile this component")
+ set(POLKITQT_FOUND FALSE)
+ return()
+ else (POLKITQT_VERSION VERSION_LESS POLKITQT_MIN_VERSION)
+ if ( NOT PC_POLKITQT_PREFIX STREQUAL CMAKE_INSTALL_PREFIX )
+ message("WARNING: Installation prefix does not match PolicyKit install prefixes. You probably will need to move files installed "
+ "in POLICY_FILES_INSTALL_DIR and by dbus_add_activation_system_service to the ${PC_POLKITQT_PREFIX} prefix")
+ endif (NOT PC_POLKITQT_PREFIX STREQUAL CMAKE_INSTALL_PREFIX)
+ endif (POLKITQT_VERSION VERSION_LESS POLKITQT_MIN_VERSION)
endif (POLKITQT_FOUND)
+set(POLKITQT_POLICY_FILES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/PolicyKit/policy/)
+
mark_as_advanced(POLKITQT_INCLUDE_DIR POLKITQT_LIB)
macro(dbus_add_activation_system_service _sources)
Index: cmake/modules/FindKDE4Internal.cmake
===================================================================
--- cmake/modules/FindKDE4Internal.cmake (revisione 1020053)
+++ cmake/modules/FindKDE4Internal.cmake (copia locale)
@@ -202,7 +202,19 @@
# INSTALL_DESTINATION <installdest>, or to <installdest>/<subdir> if
# SUBDIR <subdir> is specified.
#
+# KDE4_AUTH_REGISTER_ACTIONS( HELPER_ID ACTIONS_FILE )
+# This macro registers an action file for applications using KAuth. It accepts the helper id (the DBUS name)
+# and a file containing the actions (check kdelibs/kdecore/auth/example for file format). The macro will take
+# care of generating the file according to the backend specified, and to install it in the right location
#
+# KDE4_AUTH_ADD_HELPER( _HELPER_TARGET _HELPER_ID _HELPER_USER )
+# This macro adds an helper for applications using KAuth. It accepts the target name, the helper
+# ID (the DBUS name), the user under which the helper will run on, and the sources of the helper.
+# This macro takes care of compiling the helper, generate the needed files, and install them in
+# in the right location, helper executable included
+#
+#
+#
# A note on the possible values for CMAKE_BUILD_TYPE and how KDE handles
# the flags for those buildtypes. FindKDE4Internal supports the values
# Debug, Release, RelWithDebInfo, Profile and Debugfull:
@@ -384,18 +396,19 @@
set(EXECUTABLE_OUTPUT_PATH ${kdelibs_BINARY_DIR}/bin )
if (WIN32)
- set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH} )
+ set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH} )
# CMAKE_CFG_INTDIR is the output subdirectory created e.g. by XCode and MSVC
- set(KDE4_KCFGC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kconfig_compiler )
+ set(KDE4_KCFGC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kconfig_compiler )
- set(KDE4_MEINPROC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/meinproc4 )
- set(KDE4_MAKEKDEWIDGETS_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/makekdewidgets )
+ set(KDE4_MEINPROC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/meinproc4 )
+ set(KDE4_KAUTH_POLICY_GEN_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kauth-policy-gen )
+ set(KDE4_MAKEKDEWIDGETS_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/makekdewidgets )
else (WIN32)
- set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib )
- set(KDE4_KCFGC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kconfig_compiler${CMAKE_EXECUTABLE_SUFFIX}.shell )
-
- set(KDE4_MEINPROC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/meinproc4${CMAKE_EXECUTABLE_SUFFIX}.shell )
- set(KDE4_MAKEKDEWIDGETS_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/makekdewidgets${CMAKE_EXECUTABLE_SUFFIX}.shell )
+ set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib )
+ set(KDE4_KCFGC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kconfig_compiler${CMAKE_EXECUTABLE_SUFFIX}.shell )
+ set(KDE4_KAUTH_POLICY_GEN_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kauth-policy-gen${CMAKE_EXECUTABLE_SUFFIX}.shell )
+ set(KDE4_MEINPROC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/meinproc4${CMAKE_EXECUTABLE_SUFFIX}.shell )
+ set(KDE4_MAKEKDEWIDGETS_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/makekdewidgets${CMAKE_EXECUTABLE_SUFFIX}.shell )
endif (WIN32)
set(KDE4_LIB_DIR ${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
Index: cmake/modules/MacroKAuth.cmake
===================================================================
--- cmake/modules/MacroKAuth.cmake (revisione 1020053)
+++ cmake/modules/MacroKAuth.cmake (copia locale)
@@ -1,63 +1,3 @@
+message(FATAL_ERROR "Don't include(MacroKAuth) anymore, it's now included in find_package(KDE4)")
-execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path data --locate kauth/dbus_service.stub OUTPUT_VARIABLE KDE4_KAUTH_DBUS_SERVICE_STUB ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
-message(STATUS "KAuth: DBus service stub file found at ${KDE4_KAUTH_DBUS_SERVICE_STUB}")
-execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path data --locate kauth/dbus_policy.stub OUTPUT_VARIABLE KDE4_KAUTH_DBUS_POLICY_STUB ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
-message(STATUS "KAuth: DBus policy stub file found at ${KDE4_KAUTH_DBUS_POLICY_STUB}")
-execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path libexec --locate kauth-policy-gen OUTPUT_VARIABLE KDE4_KAUTH_POLICY_GEN ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
-set( KDE4_KAUTH_DBUS_POLICY_STUB ${DATA_INSTALL_DIR}/kauth/dbus_policy.stub)
-set( KDE4_KAUTH_DBUS_SERVICE_STUB ${DATA_INSTALL_DIR}/kauth/dbus_service.stub)
-set( KDE4_KAUTH_POLICY_GEN ${LIBEXEC_INSTALL_DIR}/kauth-policy-gen)
-
-if(NOT KDE4_KAUTH_DBUS_SERVICE_STUB)
- message(FATAL_ERROR "DBus service stub file couldn't be found (required by kde4_auth_add_helper macro)")
-endif(NOT KDE4_KAUTH_DBUS_SERVICE_STUB)
-
-if(NOT KDE4_KAUTH_DBUS_POLICY_STUB)
- message(FATAL_ERROR "DBus policy stub file couldn't be found (required by kde4_auth_add_helper macro)")
-endif(NOT KDE4_KAUTH_DBUS_POLICY_STUB)
-
-if(NOT KDE4_KAUTH_POLICY_GEN)
- message(FATAL_ERROR "KAuth policy generator tool couldn't be found (required by kde4_auth_register_actions macro)")
-endif(NOT KDE4_KAUTH_POLICY_GEN)
-
-macro(kde4_auth_add_helper _HELPER_TARGET _HELPER_ID _HELPER_USER)
-
- set(HELPER_ID ${_HELPER_ID})
- set(HELPER_TARGET ${_HELPER_TARGET})
- set(HELPER_USER ${_HELPER_USER})
-
- kde4_add_executable(${HELPER_TARGET} ${ARGN})
- target_link_libraries(${HELPER_TARGET} ${KDE4_KDECORE_LIBS})
- install(TARGETS ${HELPER_TARGET} DESTINATION ${LIBEXEC_INSTALL_DIR})
-
- configure_file(${KDE4_KAUTH_DBUS_POLICY_STUB} ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.conf)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.conf DESTINATION ${SYSCONF_INSTALL_DIR}/dbus-1/system.d/)
-
- configure_file(${KDE4_KAUTH_DBUS_SERVICE_STUB} ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.service)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.service DESTINATION ${DBUS_SYSTEM_SERVICES_INSTALL_DIR})
-
-
-endmacro(kde4_auth_add_helper)
-
-macro(kde4_auth_register_actions HELPER_ID ACTIONS_FILE)
-
-if(APPLE)
- install(CODE "execute_process(COMMAND ${KDE4_KAUTH_POLICY_GEN} ${ACTIONS_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})")
-elseif(UNIX)
- set(_output ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.policy)
- get_filename_component(_input ${ACTIONS_FILE} ABSOLUTE)
-
- add_custom_command(OUTPUT ${_output}
- COMMAND ${KDE4_KAUTH_POLICY_GEN} ${_input} > ${_output}
- MAIN_DEPENDENCY ${_input}
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- COMMENT "Generating ${HELPER_ID}.policy")
- add_custom_target("actions for ${HELPER_ID}" ALL DEPENDS ${_output})
-
- if (POLKITQT_FOUND)
- install(FILES ${_output} DESTINATION ${POLICY_FILES_INSTALL_DIR})
- endif (POLKITQT_FOUND)
-endif()
-
-endmacro(kde4_auth_register_actions)
Index: cmake/modules/KDE4Macros.cmake
===================================================================
--- cmake/modules/KDE4Macros.cmake (revisione 1020053)
+++ cmake/modules/KDE4Macros.cmake (copia locale)
@@ -22,6 +22,7 @@
# KDE4_ADD_APP_ICON
# KDE4_CREATE_MANPAGE
# KDE4_CREATE_BASIC_CMAKE_VERSION_FILE (function)
+# KDE4_Auth
# Copyright (c) 2006-2009 Alexander Neundorf, <[email protected]>
# Copyright (c) 2006, 2007, Laurent Montel, <[email protected]>
@@ -1217,7 +1218,61 @@
endif (NOT CMAKE_SKIP_RPATH)
endmacro (KDE4_HANDLE_RPATH_FOR_LIBRARY)
+# This macro adds an helper for applications using KAuth. It accepts the target name, the helper
+# ID (the DBUS name), the user under which the helper will run on, and the sources of the helper.
+# This macro takes care of compiling the helper, generate the needed files, and install them in
+# in the right location, helper executable included
+macro(KDE4_AUTH_ADD_HELPER _HELPER_TARGET _HELPER_ID _HELPER_USER)
+
+ set(HELPER_ID ${_HELPER_ID})
+ set(HELPER_TARGET ${_HELPER_TARGET})
+ set(HELPER_USER ${_HELPER_USER})
+
+ kde4_add_executable(${HELPER_TARGET} NOGUI ${ARGN})
+ target_link_libraries(${HELPER_TARGET} ${KDE4_KDECORE_LIBS})
+ install(TARGETS ${HELPER_TARGET} DESTINATION ${LIBEXEC_INSTALL_DIR})
+
+ if (_kdeBootStrapping)
+ configure_file(${CMAKE_SOURCE_DIR}/kdecore/auth/backends/dbus/dbus_policy.stub ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.conf)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.conf DESTINATION ${SYSCONF_INSTALL_DIR}/dbus-1/system.d/)
+ configure_file(${CMAKE_SOURCE_DIR}/kdecore/auth/backends/dbus/dbus_service.stub ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.service)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.service DESTINATION ${DBUS_SYSTEM_SERVICES_INSTALL_DIR})
+ else (_kdeBootStrapping)
+ configure_file(${KDE4_DATA_INSTALL_DIR}/kauth/dbus_policy.stub ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.conf)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.conf DESTINATION ${SYSCONF_INSTALL_DIR}/dbus-1/system.d/)
+
+ configure_file(${KDE4_DATA_INSTALL_DIR}/kauth/dbus_service.stub ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.service)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.service DESTINATION ${DBUS_SYSTEM_SERVICES_INSTALL_DIR})
+ endif (_kdeBootStrapping)
+endmacro(KDE4_AUTH_ADD_HELPER)
+
+# This macro registers an action file for applications using KAuth. It accepts the helper id (the DBUS name)
+# and a file containing the actions (check kdelibs/kdecore/auth/example for file format). The macro will take
+# care of generating the file according to the backend specified, and to install it in the right location
+macro(KDE4_AUTH_REGISTER_ACTIONS HELPER_ID ACTIONS_FILE)
+
+if(APPLE)
+ install(CODE "execute_process(COMMAND ${KDE4_KAUTH_POLICY_GEN} ${ACTIONS_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})")
+elseif(UNIX)
+ set(_output ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.policy)
+ get_filename_component(_input ${ACTIONS_FILE} ABSOLUTE)
+
+ add_custom_command(OUTPUT ${_output}
+ COMMAND ${KDE4_KAUTH_POLICY_GEN_EXECUTABLE} ${_input} > ${_output}
+ MAIN_DEPENDENCY ${_input}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMENT "Generating ${HELPER_ID}.policy")
+ add_custom_target("actions for ${HELPER_ID}" ALL DEPENDS ${_output})
+
+ if (POLKITQT_FOUND)
+ install(FILES ${_output} DESTINATION ${POLKITQT_POLICY_FILES_INSTALL_DIR})
+ endif (POLKITQT_FOUND)
+endif()
+
+endmacro(KDE4_AUTH_REGISTER_ACTIONS)
+
+
macro(_KDE4_EXPORT_LIBRARY_DEPENDENCIES _append_or_write _filename)
message(FATAL_ERROR "_KDE4_EXPORT_LIBRARY_DEPENDENCIES() was an internal macro and has been removed again. Just remove the code which calls it, there is no substitute.")
endmacro(_KDE4_EXPORT_LIBRARY_DEPENDENCIES)
Index: kdecore/CMakeLists.txt
===================================================================
--- kdecore/CMakeLists.txt (revisione 1020053)
+++ kdecore/CMakeLists.txt (copia locale)
@@ -366,7 +366,7 @@
auth/backends/fake/kauth-policy-gen-polkit.cpp )
endif()
-kde4_add_executable(kauth-policy-gen ${kauth_policy_gen_SRCS})
+kde4_add_executable(kauth-policy-gen NOGUI RUN_UNINSTALLED ${kauth_policy_gen_SRCS})
set( KAUTH_POLICY_GEN_LIBRARIES ${QT_QTCORE_LIBRARY} )
@@ -378,7 +378,7 @@
target_link_libraries( kauth-policy-gen ${KAUTH_POLICY_GEN_LIBRARIES} )
-install( TARGETS kauth-policy-gen DESTINATION ${LIBEXEC_INSTALL_DIR} COMPONENT Devel)
+install( TARGETS kauth-policy-gen EXPORT kdelibsToolsTargets DESTINATION ${LIBEXEC_INSTALL_DIR})
########### next target ###############
Index: plasma/CMakeLists.txt
===================================================================
--- plasma/CMakeLists.txt (revisione 1020053)
+++ plasma/CMakeLists.txt (copia locale)
@@ -346,12 +346,6 @@
########### next target ###############
-include(MacroKAuth)
-
-set( KDE4_KAUTH_DBUS_POLICY_STUB ${CMAKE_SOURCE_DIR}/kdecore/auth/backends/dbus/dbus_policy.stub)
-set( KDE4_KAUTH_DBUS_SERVICE_STUB ${CMAKE_SOURCE_DIR}/kdecore/auth/backends/dbus/dbus_service.stub)
-set( KDE4_KAUTH_POLICY_GEN kauth-policy-gen)
-
kde4_auth_add_helper(kcmremotewidgetshelper org.kde.kcontrol.kcmremotewidgets root private/remotewidgetshelper.cpp)
kde4_auth_register_actions(org.kde.kcontrol.kcmremotewidgets kcm_remotewidgets.actions)
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Kde-buildsystem mailing list [email protected] https://mail.kde.org/mailman/listinfo/kde-buildsystem
