summaryrefslogtreecommitdiffstats
path: root/examples/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'examples/CMakeLists.txt')
-rw-r--r--examples/CMakeLists.txt132
1 files changed, 71 insertions, 61 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index f6af3fa10..d3b3a8407 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,89 +1,99 @@
+#################################################
+#
+# (C) 2021 Michele Calgaro
+# Michele (DOT) Calgaro (AT) yahoo.it
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
-install(FILES org.qt.policykit.examples.policy DESTINATION ${SHARE_INSTALL_PREFIX}/polkit-1/actions/)
include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_SOURCE_DIR}/gui
+ ${CMAKE_SOURCE_DIR}
+ ${CMAKE_SOURCE_DIR}/core
+ ${CMAKE_SOURCE_DIR}/gui
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${TQT_INCLUDE_DIRS}
+ ${DBUS_TQT_INCLUDE_DIRS}
)
-set(polkit_example_SRCS
- main.cpp
- PkExample.cpp
+link_directories(
+ ${TQT_LIBRARY_DIRS}
)
-SET(polkit_example_RESOUCES
- icons/icons.qrc
-)
-QT4_WRAP_CPP(polkit_example_MOC_SRCS
- PkExample.h
-)
+##### install paths setup #######################
-QT4_WRAP_UI(polkit_example_UI_SRCS
- PkExample.ui
-)
+tde_setup_dbus( dbus-1-tqt )
+
+set( POLKIT_TQT_EXAMPLE "${DATA_INSTALL_DIR}/polkit-tqt/examples/" )
-QT4_ADD_RESOURCES (qtsourceview_RC_SRCS ${polkit_example_RESOUCES})
+##### install examples runtime config ###########################
-add_executable(polkit-example
- ${polkit_example_SRCS}
- ${polkit_example_MOC_SRCS}
- ${polkit_example_UI_SRCS}
- ${qtsourceview_RC_SRCS}
+configure_file( org.tqt.policykit.examples.service.cmake org.tqt.policykit.examples.service @ONLY )
+
+install(
+ FILES org.tqt.policykit.examples.policy
+ DESTINATION ${SHARE_INSTALL_PREFIX}/polkit-1/actions/
)
-target_link_libraries(polkit-example
- ${QT_QTCORE_LIBRARY}
- ${QT_QTGUI_LIBRARY}
- polkit-qt-gui-1
- polkit-qt-core-1
+install(
+ FILES org.tqt.policykit.examples.conf
+ DESTINATION ${DBUS_SYSTEM_CONF_DIRECTORY}
)
-#--------Helper Application
-
-# This macro is defined in FindPolkitQt.cmake
-macro(dbus_add_activation_system_service _sources)
- foreach (_i ${_sources})
- get_filename_component(_service_file ${_i} ABSOLUTE)
- string(REGEX REPLACE "\\.service.*$" ".service" _output_file ${_i})
- set(_target ${CMAKE_CURRENT_BINARY_DIR}/${_output_file})
- configure_file(${_service_file} ${_target})
- install(FILES ${_target} DESTINATION ${SHARE_INSTALL_PREFIX}/dbus-1/system-services )
- #install(FILES ${_target} DESTINATION ${_install_dir})
- endforeach (_i ${ARGN})
-endmacro(dbus_add_activation_system_service _sources)
-
-set(polkit_example_helper_SRCS
- PkExampleHelper.cpp
- mainHelper.cpp
+install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/org.tqt.policykit.examples.service
+ DESTINATION ${DBUS_SERVICE_DIRECTORY}
)
-qt4_add_dbus_adaptor(polkit_example_helper_SRCS
- org.qt.policykit.examples.xml
- PkExampleHelper.h
- PkExampleHelper
+
+##### install examples source code ###########################
+
+install(
+ FILES COPYING
+ DESTINATION ${POLKIT_TQT_EXAMPLE}
)
-QT4_WRAP_CPP(polkit_example_helper_MOC_SRCS
- PkExampleHelper.h
+install(
+ FILES
+ org.tqt.policykit.examples.conf
+ org.tqt.policykit.examples.policy
+ org.tqt.policykit.examples.xml
+ ${CMAKE_CURRENT_BINARY_DIR}/org.tqt.policykit.examples.service
+ DESTINATION ${POLKIT_TQT_EXAMPLE}/config
)
-add_executable(polkit-example-helper
- ${polkit_example_helper_SRCS}
- ${polkit_example_helper_MOC_SRCS}
+install(
+ FILES PkExample.h PkExample.cpp main.cpp
+ DESTINATION ${POLKIT_TQT_EXAMPLE}/main
)
-# see our helper is pretty small :D
-target_link_libraries(polkit-example-helper
- ${QT_QTCORE_LIBRARY}
- polkit-qt-core-1
+install(
+ FILES PkExampleHelper.h PkExampleHelper.cpp mainHelper.cpp
+ DESTINATION ${POLKIT_TQT_EXAMPLE}/helper
)
-install(TARGETS polkit-example-helper DESTINATION ${BIN_INSTALL_DIR})
-dbus_add_activation_system_service(org.qt.policykit.examples.service.in)
+##### install icons ###########################
-install(FILES org.qt.policykit.examples.conf DESTINATION ${SYSCONF_INSTALL_DIR}/dbus-1/system.d)
+add_subdirectory( icons )
+
+
+##### example executables #########################
+
+tde_add_executable( polkit-tqt-example AUTOMOC
+ SOURCES PkExample.cpp main.cpp
+ LINK ${TQT_LIBRARIES} ${DBUS_TQT_LIBRARIES} polkit-tqt-core-shared polkit-tqt-gui-shared
+ DESTINATION ${BIN_INSTALL_DIR}
+)
+
+tde_add_executable( polkit-tqt-example-helper AUTOMOC
+ SOURCES PkExampleHelper.cpp mainHelper.cpp
+ LINK ${TQT_LIBRARIES} ${DBUS_TQT_LIBRARIES} polkit-tqt-core-shared
+ DESTINATION ${BIN_INSTALL_DIR}
+)
-add_subdirectory(agent)