diff options
Diffstat (limited to 'cmake/modules')
-rw-r--r-- | cmake/modules/BasicFindPackageVersion.cmake.in | 30 | ||||
-rw-r--r-- | cmake/modules/CMakeLists.txt | 9 | ||||
-rw-r--r-- | cmake/modules/FindAutomoc4.cmake | 81 | ||||
-rw-r--r-- | cmake/modules/FindGIO.cmake | 66 | ||||
-rw-r--r-- | cmake/modules/FindGLIB2.cmake | 55 | ||||
-rw-r--r-- | cmake/modules/FindGObject.cmake | 75 | ||||
-rw-r--r-- | cmake/modules/FindPolkit.cmake | 75 | ||||
-rw-r--r-- | cmake/modules/FindPolkitQt-1.cmake | 37 | ||||
-rw-r--r-- | cmake/modules/InstallSettings.cmake | 136 | ||||
-rw-r--r-- | cmake/modules/MacroPushRequiredVars.cmake | 47 | ||||
-rw-r--r-- | cmake/modules/MacroWriteBasicCMakeVersionFile.cmake | 22 | ||||
-rw-r--r-- | cmake/modules/PolkitQt-1Dist.cmake | 16 |
12 files changed, 649 insertions, 0 deletions
diff --git a/cmake/modules/BasicFindPackageVersion.cmake.in b/cmake/modules/BasicFindPackageVersion.cmake.in new file mode 100644 index 000000000..ae5d3125f --- /dev/null +++ b/cmake/modules/BasicFindPackageVersion.cmake.in @@ -0,0 +1,30 @@ +# This is a very basic file for the new style find_package() search mode, +# i.e. Config-mode. It is used by MACRO_WRITE_BASIC_CMAKE_VERSION_FILE() from +# MacroWriteBasicCMakeVersionFile.cmake. +# In this mode find_package() searches for a <package>Config.cmake +# file and an associated <package>Version.cmake file, which it loads to check +# the version number. +# This file can be used with configure_file() to generate such a file for a project +# with very basic logic. +# It sets PACKAGE_VERSION_EXACT if the current version string and the requested +# version string are exactly the same and it sets PACKAGE_VERSION_COMPATIBLE +# if the current version is >= requested version. +# If this is not good enough for your project, you need to write your own +# improved <package>Version.cmake file. +# This file requires the following three variables to be set: +# PROJECT_VERSION_MAJOR +# PROJECT_VERSION_MINOR +# PROJECT_VERSION_PATCH + + +set(PACKAGE_VERSION @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@) + +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") +endif("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt new file mode 100644 index 000000000..37511d618 --- /dev/null +++ b/cmake/modules/CMakeLists.txt @@ -0,0 +1,9 @@ + +## install the cmake files + +#file( GLOB cmakeFiles FindPolkitQt.cmake ) +#set(module_install_dir ${CMAKE_ROOT}/Modules ) + +#install( FILES ${cmakeFiles} +# DESTINATION ${module_install_dir} ) + diff --git a/cmake/modules/FindAutomoc4.cmake b/cmake/modules/FindAutomoc4.cmake new file mode 100644 index 000000000..fb6dc7743 --- /dev/null +++ b/cmake/modules/FindAutomoc4.cmake @@ -0,0 +1,81 @@ +# - Try to find automoc4 +# Once done this will define +# +# AUTOMOC4_FOUND - automoc4 has been found +# AUTOMOC4_EXECUTABLE - the automoc4 tool +# AUTOMOC4_VERSION - the full version of automoc4 +# AUTOMOC4_VERSION_MAJOR, AUTOMOC4_VERSION_MINOR, AUTOMOC4_VERSION_PATCH - AUTOMOC4_VERSION +# broken into its components +# +# It also adds the following macros +# AUTOMOC4(<target> <SRCS_VAR>) +# Use this to run automoc4 on all files contained in the list <SRCS_VAR>. +# +# AUTOMOC4_MOC_HEADERS(<target> header1.h header2.h ...) +# Use this to add more header files to be processed with automoc4. +# +# AUTOMOC4_ADD_EXECUTABLE(<target_NAME> src1 src2 ...) +# This macro does the same as ADD_EXECUTABLE, but additionally +# adds automoc4 handling for all source files. +# +# AUTOMOC4_ADD_LIBRARY(<target_NAME> src1 src2 ...) +# This macro does the same as ADD_LIBRARY, but additionally +# adds automoc4 handling for all source files. + +# Internal helper macro, may change or be removed anytime: +# _ADD_AUTOMOC4_TARGET(<target_NAME> <SRCS_VAR>) +# +# Since version 0.9.88: +# The following two macros are only to be used for KDE4 projects +# and do something which makes sure automoc4 works for KDE. Don't +# use them anywhere else. +# _AUTOMOC4_KDE4_PRE_TARGET_HANDLING(<target_NAME> <SRCS_VAR>) +# _AUTOMOC4_KDE4_POST_TARGET_HANDLING(<target_NAME>) + + +# Copyright (c) 2008-2009, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +# check if we are inside KDESupport +if("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") + # when building this project as part of kdesupport + set(AUTOMOC4_CONFIG_FILE "${KDESupport_SOURCE_DIR}/automoc/Automoc4Config.cmake") +else("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") + # when building this project outside kdesupport + + # CMAKE_[SYSTEM_]PREFIX_PATH exists starting with cmake 2.6.0 + file(TO_CMAKE_PATH "$ENV{CMAKE_PREFIX_PATH}" _env_CMAKE_PREFIX_PATH) + file(TO_CMAKE_PATH "$ENV{CMAKE_LIBRARY_PATH}" _env_CMAKE_LIBRARY_PATH) + + find_file(AUTOMOC4_CONFIG_FILE NAMES Automoc4Config.cmake + PATH_SUFFIXES automoc4 lib/automoc4 lib64/automoc4 + PATHS ${_env_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH} ${CMAKE_SYSTEM_PREFIX_PATH} + ${_env_CMAKE_LIBRARY_PATH} ${CMAKE_LIBRARY_PATH} ${CMAKE_SYSTEM_LIBRARY_PATH} + ${CMAKE_INSTALL_PREFIX} + NO_DEFAULT_PATH ) +endif("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") + + +if(AUTOMOC4_CONFIG_FILE) + include(${AUTOMOC4_CONFIG_FILE}) + set(AUTOMOC4_FOUND TRUE) +else(AUTOMOC4_CONFIG_FILE) + set(AUTOMOC4_FOUND FALSE) +endif(AUTOMOC4_CONFIG_FILE) + +if (AUTOMOC4_FOUND) + if (NOT Automoc4_FIND_QUIETLY) + message(STATUS "Found Automoc4: ${AUTOMOC4_EXECUTABLE}") + endif (NOT Automoc4_FIND_QUIETLY) +else (AUTOMOC4_FOUND) + if (Automoc4_FIND_REQUIRED) + message(FATAL_ERROR "Did not find automoc4 (part of kdesupport).") + else (Automoc4_FIND_REQUIRED) + if (NOT Automoc4_FIND_QUIETLY) + message(STATUS "Did not find automoc4 (part of kdesupport).") + endif (NOT Automoc4_FIND_QUIETLY) + endif (Automoc4_FIND_REQUIRED) +endif (AUTOMOC4_FOUND) diff --git a/cmake/modules/FindGIO.cmake b/cmake/modules/FindGIO.cmake new file mode 100644 index 000000000..14d38045b --- /dev/null +++ b/cmake/modules/FindGIO.cmake @@ -0,0 +1,66 @@ +# - Try to find the GIO libraries +# Once done this will define +# +# GIO_FOUND - system has GIO +# GIO_INCLUDE_DIR - the GIO include directory +# GIO_LIBRARIES - GIO library + +if(GIO_INCLUDE_DIR AND GIO_LIBRARIES) + # Already in cache, be silent + set(GIO_FIND_QUIETLY TRUE) +endif(GIO_INCLUDE_DIR AND GIO_LIBRARIES) + +if (NOT WIN32) + include(UsePkgConfig) + pkgconfig(gio-2.0 _LibGIOIncDir _LibGIOLinkDir _LibGIOLinkFlags _LibGIOCflags) +endif(NOT WIN32) + +MESSAGE(STATUS "gio include dir: ${_LibGIOIncDir}") + +# first try without default paths to respect PKG_CONFIG_PATH + +find_path(GIO_MAIN_INCLUDE_DIR glib.h + PATH_SUFFIXES glib-2.0 + PATHS ${_LibGIOIncDir} + NO_DEFAULT_PATH) + +find_path(GIO_MAIN_INCLUDE_DIR glib.h + PATH_SUFFIXES glib-2.0 + PATHS ${_LibGIOIncDir} ) + +MESSAGE(STATUS "found gio main include dir: ${GIO_MAIN_INCLUDE_DIR}") + +# search the glibconfig.h include dir under the same root where the library is found +find_library(GIO_LIBRARIES + NAMES gio-2.0 + PATHS ${_LibGIOLinkDir} + NO_DEFAULT_PATH) + +find_library(GIO_LIBRARIES + NAMES gio-2.0 + PATHS ${_LibGIOLinkDir}) + + +get_filename_component(GIOLibDir "${GIO_LIBRARIES}" PATH) + +find_path(GIO_INTERNAL_INCLUDE_DIR glibconfig.h + PATH_SUFFIXES glib-2.0/include + PATHS ${_LibGIOIncDir} "${GIOLibDir}" ${CMAKE_SYSTEM_LIBRARY_PATH} + NO_DEFAULT_PATH) + +find_path(GIO_INTERNAL_INCLUDE_DIR glibconfig.h + PATH_SUFFIXES glib-2.0/include + PATHS ${_LibGIOIncDir} "${GIOLibDir}" ${CMAKE_SYSTEM_LIBRARY_PATH}) + +set(GIO_INCLUDE_DIR "${GIO_MAIN_INCLUDE_DIR}") + +# not sure if this include dir is optional or required +# for now it is optional +if(GIO_INTERNAL_INCLUDE_DIR) + set(GIO_INCLUDE_DIR ${GIO_INCLUDE_DIR} "${GIO_INTERNAL_INCLUDE_DIR}") +endif(GIO_INTERNAL_INCLUDE_DIR) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GIO DEFAULT_MSG GIO_LIBRARIES GIO_MAIN_INCLUDE_DIR) + +mark_as_advanced(GIO_INCLUDE_DIR GIO_LIBRARIES) diff --git a/cmake/modules/FindGLIB2.cmake b/cmake/modules/FindGLIB2.cmake new file mode 100644 index 000000000..083144dea --- /dev/null +++ b/cmake/modules/FindGLIB2.cmake @@ -0,0 +1,55 @@ +# - Try to find the GLIB2 libraries +# Once done this will define +# +# GLIB2_FOUND - system has glib2 +# GLIB2_INCLUDE_DIR - the glib2 include directory +# GLIB2_LIBRARIES - glib2 library + +# Copyright (c) 2008 Laurent Montel, <montel@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +if(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES) + # Already in cache, be silent + set(GLIB2_FIND_QUIETLY TRUE) +endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES) + +if (NOT WIN32) + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(PC_LibGLIB2 glib-2.0) + endif (PKG_CONFIG_FOUND) +endif(NOT WIN32) + +if (PC_LibGLIB2_INCLUDEDIR) + set(GLIB2_MAIN_INCLUDE_DIR ${PC_LibGLIB2_INCLUDEDIR}) +else (PC_LibGLIB2_INCLUDEDIR) + find_path(GLIB2_MAIN_INCLUDE_DIR NAMES glib.h PATH_SUFFIXES glib-2.0) +endif (PC_LibGLIB2_INCLUDEDIR) + +# search the glibconfig.h include dir under the same root where the library is found +find_library(GLIB2_LIBRARIES + NAMES glib-2.0 + HINTS ${PC_LibGLIB2_LIBDIR} +) + +get_filename_component(glib2LibDir "${GLIB2_LIBRARIES}" PATH) + +find_path(GLIB2_INTERNAL_INCLUDE_DIR glibconfig.h + PATH_SUFFIXES glib-2.0/include + HINTS ${PC_LibGLIB2_INCLUDEDIR} "${glib2LibDir}" ${CMAKE_SYSTEM_LIBRARY_PATH}) + +set(GLIB2_INCLUDE_DIR "${GLIB2_MAIN_INCLUDE_DIR}") + +# not sure if this include dir is optional or required +# for now it is optional +if(GLIB2_INTERNAL_INCLUDE_DIR) + set(GLIB2_INCLUDE_DIR ${GLIB2_INCLUDE_DIR} "${GLIB2_INTERNAL_INCLUDE_DIR}") +endif(GLIB2_INTERNAL_INCLUDE_DIR) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GLIB2 DEFAULT_MSG GLIB2_LIBRARIES GLIB2_MAIN_INCLUDE_DIR) + +mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES) diff --git a/cmake/modules/FindGObject.cmake b/cmake/modules/FindGObject.cmake new file mode 100644 index 000000000..79a212787 --- /dev/null +++ b/cmake/modules/FindGObject.cmake @@ -0,0 +1,75 @@ +# - Try to find GObject +# Once done this will define +# +# GOBJECT_FOUND - system has GObject +# GOBJECT_INCLUDE_DIR - the GObject include directory +# GOBJECT_LIBRARIES - the libraries needed to use GObject +# GOBJECT_DEFINITIONS - Compiler switches required for using GObject + +# Copyright (c) 2008 Helio Chissini de Castro, <helio@kde.org> +# (c)2006, Tim Beaulen <tbscope@gmail.com> + + +IF (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES) + # in cache already + SET(GObject_FIND_QUIETLY TRUE) +ELSE (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES) + SET(GObject_FIND_QUIETLY FALSE) +ENDIF (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES) + +IF (NOT WIN32) + FIND_PACKAGE(PkgConfig) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + PKG_CHECK_MODULES(PKG_GOBJECT2 gobject-2.0) + SET(GOBJECT_DEFINITIONS ${PKG_GOBJECT2_CFLAGS}) +ENDIF (NOT WIN32) + +FIND_PATH(GOBJECT_INCLUDE_DIR gobject/gobject.h + PATHS + ${PKG_GOBJECT2_INCLUDE_DIRS} + /usr/include/glib-2.0/ + PATH_SUFFIXES glib-2.0 + ) + +FIND_LIBRARY(_GObjectLibs NAMES gobject-2.0 + PATHS + ${PKG_GOBJECT2_LIBRARY_DIRS} + ) +FIND_LIBRARY(_GModuleLibs NAMES gmodule-2.0 + PATHS + ${PKG_GOBJECT2_LIBRARY_DIRS} + ) +FIND_LIBRARY(_GThreadLibs NAMES gthread-2.0 + PATHS + ${PKG_GOBJECT2_LIBRARY_DIRS} + ) +FIND_LIBRARY(_GLibs NAMES glib-2.0 + PATHS + ${PKG_GOBJECT2_LIBRARY_DIRS} + ) + +IF (WIN32) +SET (GOBJECT_LIBRARIES ${_GObjectLibs} ${_GModuleLibs} ${_GThreadLibs} ${_GLibs}) +ELSE (WIN32) +SET (GOBJECT_LIBRARIES ${PKG_GOBJECT2_LIBRARIES}) +ENDIF (WIN32) + +IF (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES) + SET(GOBJECT_FOUND TRUE) +ELSE (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES) + SET(GOBJECT_FOUND FALSE) +ENDIF (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES) + +IF (GOBJECT_FOUND) + IF (NOT GObject_FIND_QUIETLY) + MESSAGE(STATUS "Found GObject libraries: ${GOBJECT_LIBRARIES}") + MESSAGE(STATUS "Found GObject includes : ${GOBJECT_INCLUDE_DIR}") + ENDIF (NOT GObject_FIND_QUIETLY) +ELSE (GOBJECT_FOUND) + IF (GObject_FIND_REQUIRED) + MESSAGE(STATUS "Could NOT find GObject") + ENDIF(GObject_FIND_REQUIRED) +ENDIF (GOBJECT_FOUND) + +MARK_AS_ADVANCED(GOBJECT_INCLUDE_DIR GOBJECT_LIBRARIES) diff --git a/cmake/modules/FindPolkit.cmake b/cmake/modules/FindPolkit.cmake new file mode 100644 index 000000000..35fc86e15 --- /dev/null +++ b/cmake/modules/FindPolkit.cmake @@ -0,0 +1,75 @@ +# - Try to find Polkit +# Once done this will define +# +# POLKIT_FOUND - system has Polkit +# POLKIT_INCLUDE_DIRS - Polkit's include directories +# POLKIT_AGENT_INCLUDE_DIRS - Polkit-agent's include directories +# POLKIT_LIBRARIES - Link this to use polkit's gobject library +# POLKIT_AGENT_LIBRARY - Link this to use the agent wrapper in polkit +# POLKIT_DEFINITIONS - Compiler switches required for using Polkit + +# Copyright (c) 2009, Dario Freddi, <drf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if (POLKIT_INCLUDE_DIR AND POLKIT_LIB) + set(POLKIT_FIND_QUIETLY TRUE) +endif (POLKIT_INCLUDE_DIR AND POLKIT_LIB) + +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_POLKIT polkit-gobject-1) + pkg_check_modules(PC_POLKIT_AGENT polkit-agent-1) + set(POLKIT_DEFINITIONS ${PC_POLKIT_CFLAGS_OTHER}) +endif (NOT WIN32) + +# We must include glib paths too... which sucks balls +find_package(GLIB2) + +find_path( GLIB_CONFIG_INCLUDE_DIR + NAMES glibconfig.h + PATH_SUFFIXES glib-2.0/include + HINTS ${PC_POLKIT_INCLUDE_DIRS} +) + +find_path( POLKIT_INCLUDE_DIR + NAMES polkit/polkit.h + PATH_SUFFIXES polkit-1 + HINTS ${PC_POLKIT_INCLUDE_DIRS} +) + +find_path( POLKIT_AGENT_INCLUDE_DIR + NAMES polkitagent/polkitagent.h + PATH_SUFFIXES polkit-1 + HINTS ${PC_POLKIT_AGENT_INCLUDE_DIRS} +) + +#set(POLKIT_INCLUDE_DIRS ${GLIB2_INCLUDE_DIR} ${_POLKIT_INCLUDE_DIR}) +#set(POLKIT_AGENT_INCLUDE_DIRS ${GLIB2_INCLUDE_DIR} ${_POLKIT_AGENT_INCLUDE_DIR}) + +find_library( POLKIT_LIBRARIES + NAMES polkit-gobject-1 + HINTS ${PC_POLKIT_LIBDIR} +) + +find_library( POLKIT_AGENT_LIBRARY + NAMES polkit-agent-1 + HINTS ${PC_POLKIT_AGENT_LIBDIR} +) + +#set(POLKIT_LIBRARIES ${_POLKIT_LIBRARIES} ${GLIB2_LIBRARIES}) +#set(POLKIT_AGENT_LIBRARY ${_POLKIT_AGENT_LIBRARY} ${GLIB2_LIBRARIES}) + +include(FindPackageHandleStandardArgs) + +# 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_LIBRARIES POLKIT_AGENT_LIBRARY + POLKIT_INCLUDE_DIR POLKIT_AGENT_INCLUDE_DIR GLIB2_FOUND) + +mark_as_advanced(POLKIT_INCLUDE_DIRS POLKIT_AGENT_INCLUDE_DIRS POLKIT_LIBRARIES POLKIT_AGENT_LIBRARY GLIB_INCLUDE_DIR) + +set(POLKIT_POLICY_FILES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/polkit-1/actions) diff --git a/cmake/modules/FindPolkitQt-1.cmake b/cmake/modules/FindPolkitQt-1.cmake new file mode 100644 index 000000000..30d27de15 --- /dev/null +++ b/cmake/modules/FindPolkitQt-1.cmake @@ -0,0 +1,37 @@ +# - Try to find PolkitQt-1 +# Once done this will define +# +# POLKITQT-1_FOUND - system has Polkit-qt +# POLKITQT-1_INCLUDE_DIR - the Polkit-qt include directory +# POLKITQT-1_LIBRARIES - Link these to use all Polkit-qt libs +# POLKITQT-1_CORE_LIBRARY - Link this to use the polkit-qt-core library only +# POLKITQT-1_GUI_LIBRARY - Link this to use GUI elements in polkit-qt (polkit-qt-gui) +# POLKITQT-1_AGENT_LIBRARY - Link this to use the agent wrapper in polkit-qt +# POLKITQT-1_DEFINITIONS - Compiler switches required for using Polkit-qt +# +# The minimum required version of PolkitQt-1 can be specified using the +# standard syntax, e.g. find_package(PolkitQt-1 1.0) + +# Copyright (c) 2010, Dario Freddi, <drf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +# Support POLKITQT-1_MIN_VERSION for compatibility: +if ( NOT PolkitQt-1_FIND_VERSION AND POLKITQT-1_MIN_VERSION ) + set ( PolkitQt-1_FIND_VERSION ${POLKITQT-1_MIN_VERSION} ) +endif ( NOT PolkitQt-1_FIND_VERSION AND POLKITQT-1_MIN_VERSION ) + +set( _PolkitQt-1_FIND_QUIETLY ${PolkitQt-1_FIND_QUIETLY} ) +find_package( PolkitQt-1 ${PolkitQt-1_FIND_VERSION} QUIET NO_MODULE PATHS ${LIB_INSTALL_DIR}/PolkitQt-1/cmake ) +set( PolkitQt-1_FIND_QUIETLY ${_PolkitQt-1_FIND_QUIETLY} ) + +include( FindPackageHandleStandardArgs ) +find_package_handle_standard_args( PolkitQt-1 DEFAULT_MSG PolkitQt-1_CONFIG ) + +if (POLKITQT-1_FOUND) + if (NOT POLKITQT-1_INSTALL_DIR 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-1_INSTALL_DIR} prefix") + endif (NOT POLKITQT-1_INSTALL_DIR STREQUAL CMAKE_INSTALL_PREFIX) +endif (POLKITQT-1_FOUND) diff --git a/cmake/modules/InstallSettings.cmake b/cmake/modules/InstallSettings.cmake new file mode 100644 index 000000000..8c7431718 --- /dev/null +++ b/cmake/modules/InstallSettings.cmake @@ -0,0 +1,136 @@ +# Copyright (c) 2008 Kevin Krammer <kevin.krammer@gmx.at> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" ) + +if (WIN32) +# use relative install prefix to avoid hardcoded install paths in cmake_install.cmake files + + set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" ) # The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}) + + set(EXEC_INSTALL_PREFIX "" ) # Base directory for executables and libraries + set(SHARE_INSTALL_PREFIX "share" ) # Base directory for files which go to share/ + set(BIN_INSTALL_DIR "bin" ) # The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin) + set(SBIN_INSTALL_DIR "sbin" ) # The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin) + + set(LIBEXEC_INSTALL_DIR "${BIN_INSTALL_DIR}" ) # The subdirectory relative to the install prefix where libraries will be installed (default is ${BIN_INSTALL_DIR}) + set(INCLUDE_INSTALL_DIR "include" ) # The subdirectory to the header prefix + + set(PLUGIN_INSTALL_DIR "lib${LIB_SUFFIX}/kde4" ) # "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde4) + set(CONFIG_INSTALL_DIR "share/config" ) # The config file install dir + set(DATA_INSTALL_DIR "share/apps" ) # The parent directory where applications can install their data + set(HTML_INSTALL_DIR "share/doc/HTML" ) # The HTML install dir for documentation + set(ICON_INSTALL_DIR "share/icons" ) # The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/) + set(KCFG_INSTALL_DIR "share/config.kcfg" ) # The install dir for kconfig files + set(LOCALE_INSTALL_DIR "share/locale" ) # The install dir for translations + set(MIME_INSTALL_DIR "share/mimelnk" ) # The install dir for the mimetype desktop files + set(SERVICES_INSTALL_DIR "share/kde4/services" ) # The install dir for service (desktop, protocol, ...) files + set(SERVICETYPES_INSTALL_DIR "share/kde4/servicetypes" ) # The install dir for servicestypes desktop files + set(SOUND_INSTALL_DIR "share/sounds" ) # The install dir for sound files + set(TEMPLATES_INSTALL_DIR "share/templates" ) # The install dir for templates (Create new file...) + set(WALLPAPER_INSTALL_DIR "share/wallpapers" ) # The install dir for wallpapers + set(DEMO_INSTALL_DIR "share/demos" ) # The install dir for demos + set(KCONF_UPDATE_INSTALL_DIR "share/apps/kconf_update" ) # The kconf_update install dir + set(AUTOSTART_INSTALL_DIR "share/autostart" ) # The install dir for autostart files + + set(XDG_APPS_INSTALL_DIR "share/applications/kde4" ) # The XDG apps dir + set(XDG_DIRECTORY_INSTALL_DIR "share/desktop-directories" ) # The XDG directory + set(XDG_MIME_INSTALL_DIR "share/mime/packages" ) # The install dir for the xdg mimetypes + + set(SYSCONF_INSTALL_DIR "etc" ) # The kde sysconfig install dir (default /etc) + set(MAN_INSTALL_DIR "share/man" ) # The kde man install dir (default ${SHARE_INSTALL_PREFIX}/man/) + set(INFO_INSTALL_DIR "share/info" ) # The kde info install dir (default ${SHARE_INSTALL_PREFIX}/info)") + set(DBUS_INTERFACES_INSTALL_DIR "share/dbus-1/interfaces" ) # The kde dbus interfaces install dir (default ${SHARE_INSTALL_PREFIX}/dbus-1/interfaces)") + set(DBUS_SERVICES_INSTALL_DIR "share/dbus-1/services" ) # The kde dbus services install dir (default ${SHARE_INSTALL_PREFIX}/dbus-1/services)") + +else (WIN32) + + # this macro implements some very special logic how to deal with the cache + # by default the various install locations inherit their value from theit "parent" variable + # so if you set CMAKE_INSTALL_PREFIX, then EXEC_INSTALL_PREFIX, PLUGIN_INSTALL_DIR will + # calculate their value by appending subdirs to CMAKE_INSTALL_PREFIX + # this would work completely without using the cache. + # but if somebody wants e.g. a different EXEC_INSTALL_PREFIX this value has to go into + # the cache, otherwise it will be forgotten on the next cmake run. + # Once a variable is in the cache, it doesn't depend on its "parent" variables + # anymore and you can only change it by editing it directly. + # this macro helps in this regard, because as long as you don't set one of the + # variables explicitely to some location, it will always calculate its value from its + # parents. So modifying CMAKE_INSTALL_PREFIX later on will have the desired effect. + # But once you decide to set e.g. EXEC_INSTALL_PREFIX to some special location + # this will go into the cache and it will no longer depend on CMAKE_INSTALL_PREFIX. + macro(_SET_FANCY _var _value _comment) + set(predefinedvalue "${_value}") + + if (NOT DEFINED ${_var}) + set(${_var} ${predefinedvalue}) + else (NOT DEFINED ${_var}) + set(${_var} "${${_var}}" CACHE PATH "${_comment}") + endif (NOT DEFINED ${_var}) + endmacro(_SET_FANCY) + + + _set_fancy(EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" "Base directory for executables and libraries") + _set_fancy(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Base directory for files which go to share/") + _set_fancy(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" "The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin)") + _set_fancy(SBIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/sbin" "The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin)") + _set_fancy(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" "The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX})") + _set_fancy(LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/kde4/libexec" "The subdirectory relative to the install prefix where libraries will be installed (default is ${LIB_INSTALL_DIR}/kde4/libexec)") + _set_fancy(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "The subdirectory to the header prefix") + + _set_fancy(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde4" "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde4)") + _set_fancy(CONFIG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config" "The config file install dir") + _set_fancy(DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" "The parent directory where applications can install their data") + _set_fancy(HTML_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/doc/HTML" "The HTML install dir for documentation") + _set_fancy(ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/)") + _set_fancy(KCFG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config.kcfg" "The install dir for kconfig files") + _set_fancy(LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale" "The install dir for translations") + _set_fancy(MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mimelnk" "The install dir for the mimetype desktop files") + _set_fancy(SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/kde4/services" "The install dir for service (desktop, protocol, ...) files") + _set_fancy(SERVICETYPES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/kde4/servicetypes" "The install dir for servicestypes desktop files") + _set_fancy(SOUND_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/sounds" "The install dir for sound files") + _set_fancy(TEMPLATES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/templates" "The install dir for templates (Create new file...)") + _set_fancy(WALLPAPER_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/wallpapers" "The install dir for wallpapers") + _set_fancy(DEMO_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/demos" "The install dir for demos") + _set_fancy(KCONF_UPDATE_INSTALL_DIR "${DATA_INSTALL_DIR}/kconf_update" "The kconf_update install dir") + _set_fancy(AUTOSTART_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/autostart" "The install dir for autostart files") + + _set_fancy(XDG_APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications/kde4" "The XDG apps dir") + _set_fancy(XDG_DIRECTORY_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/desktop-directories" "The XDG directory") + _set_fancy(XDG_MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mime/packages" "The install dir for the xdg mimetypes") + + _set_fancy(SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc" "The kde sysconfig install dir (default ${CMAKE_INSTALL_PREFIX}/etc)") + _set_fancy(MAN_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/man" "The kde man install dir (default ${SHARE_INSTALL_PREFIX}/man/)") + _set_fancy(INFO_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/info" "The kde info install dir (default ${SHARE_INSTALL_PREFIX}/info)") + _set_fancy(DBUS_INTERFACES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/dbus-1/interfaces" "The kde dbus interfaces install dir (default ${SHARE_INSTALL_PREFIX}/dbus-1/interfaces)") + _set_fancy(DBUS_SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/dbus-1/services" "The kde dbus services install dir (default ${SHARE_INSTALL_PREFIX}/dbus-1/services)") + +endif (WIN32) + +# The INSTALL_TARGETS_DEFAULT_ARGS variable should be used when libraries are installed. +# The arguments are also ok for regular executables, i.e. executables which don't go +# into sbin/ or libexec/, but for installing executables the basic syntax +# INSTALL(TARGETS kate DESTINATION "${BIN_INSTALL_DIR}") +# is enough, so using this variable there doesn't help a lot. +# The variable must not be used for installing plugins. +# Usage is like this: +# install(TARGETS kdecore kdeui ${INSTALL_TARGETS_DEFAULT_ARGS} ) +# +# This will install libraries correctly under UNIX, OSX and Windows (i.e. dll's go +# into bin/. +# Later on it will be possible to extend this for installing OSX frameworks +# The COMPONENT Devel argument has the effect that static libraries belong to the +# "Devel" install component. If we use this also for all install() commands +# for header files, it will be possible to install +# -everything: make install OR cmake -P cmake_install.cmake +# -only the development files: cmake -DCOMPONENT=Devel -P cmake_install.cmake +# -everything except the development files: cmake -DCOMPONENT=Unspecified -P cmake_install.cmake +# This can then also be used for packaging with cpack. + +set(INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "${BIN_INSTALL_DIR}" + LIBRARY DESTINATION "${LIB_INSTALL_DIR}" + ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" COMPONENT Devel ) + + diff --git a/cmake/modules/MacroPushRequiredVars.cmake b/cmake/modules/MacroPushRequiredVars.cmake new file mode 100644 index 000000000..650b566ee --- /dev/null +++ b/cmake/modules/MacroPushRequiredVars.cmake @@ -0,0 +1,47 @@ +# this module defines two macros: +# MACRO_PUSH_REQUIRED_VARS() +# and +# MACRO_POP_REQUIRED_VARS() +# use these if you call cmake macros which use +# any of the CMAKE_REQUIRED_XXX variables +# +# Usage: +# MACRO_PUSH_REQUIRED_VARS() +# SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -DSOME_MORE_DEF) +# CHECK_FUNCTION_EXISTS(...) +# MACRO_POP_REQUIRED_VARS() + +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +MACRO(MACRO_PUSH_REQUIRED_VARS) + + IF(NOT DEFINED _PUSH_REQUIRED_VARS_COUNTER) + SET(_PUSH_REQUIRED_VARS_COUNTER 0) + ENDIF(NOT DEFINED _PUSH_REQUIRED_VARS_COUNTER) + + MATH(EXPR _PUSH_REQUIRED_VARS_COUNTER "${_PUSH_REQUIRED_VARS_COUNTER}+1") + + SET(_CMAKE_REQUIRED_INCLUDES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_INCLUDES}) + SET(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS}) + SET(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_LIBRARIES}) + SET(_CMAKE_REQUIRED_FLAGS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_FLAGS}) +ENDMACRO(MACRO_PUSH_REQUIRED_VARS) + +MACRO(MACRO_POP_REQUIRED_VARS) + +# don't pop more than we pushed + IF("${_PUSH_REQUIRED_VARS_COUNTER}" GREATER "0") + + SET(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}}) + SET(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}}) + SET(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}}) + SET(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}}) + + MATH(EXPR _PUSH_REQUIRED_VARS_COUNTER "${_PUSH_REQUIRED_VARS_COUNTER}-1") + ENDIF("${_PUSH_REQUIRED_VARS_COUNTER}" GREATER "0") + +ENDMACRO(MACRO_POP_REQUIRED_VARS) + diff --git a/cmake/modules/MacroWriteBasicCMakeVersionFile.cmake b/cmake/modules/MacroWriteBasicCMakeVersionFile.cmake new file mode 100644 index 000000000..6f9e41898 --- /dev/null +++ b/cmake/modules/MacroWriteBasicCMakeVersionFile.cmake @@ -0,0 +1,22 @@ +# MACRO_WRITE_BASIC_CMAKE_VERSION_FILE( _filename _major _minor _patch) +# Writes a file for use as <package>ConfigVersion.cmake file to <_filename>. +# See the documentation of FIND_PACKAGE() for details on this. +# _filename is the output filename, it should be in the build tree. +# _major is the major version number of the project to be installed +# _minor is the minor version number of the project to be installed +# _patch is the patch version number of the project to be installed +# + +# Copyright (c) 2008, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +get_filename_component(_currentListFileDir ${CMAKE_CURRENT_LIST_FILE} PATH) + +function(MACRO_WRITE_BASIC_CMAKE_VERSION_FILE _filename _major _minor _patch) + set(PROJECT_VERSION_MAJOR ${_major}) + set(PROJECT_VERSION_MINOR ${_minor}) + set(PROJECT_VERSION_PATCH ${_patch}) + configure_file(${_currentListFileDir}/BasicFindPackageVersion.cmake.in "${_filename}" @ONLY) +endfunction(MACRO_WRITE_BASIC_CMAKE_VERSION_FILE _major _minor _patch) diff --git a/cmake/modules/PolkitQt-1Dist.cmake b/cmake/modules/PolkitQt-1Dist.cmake new file mode 100644 index 000000000..99122ddfd --- /dev/null +++ b/cmake/modules/PolkitQt-1Dist.cmake @@ -0,0 +1,16 @@ +SET(CPACK_PACKAGE_NAME "polkit-qt-1") +SET(CPACK_PACKAGE_VERSION_MAJOR "${POLKITQT-1_VERSION_MAJOR}") +SET(CPACK_PACKAGE_VERSION_MINOR "${POLKITQT-1_VERSION_MINOR}") +SET(CPACK_PACKAGE_VERSION_PATCH "${POLKITQT-1_VERSION_PATCH}") + +set(CPACK_SOURCE_GENERATOR "TBZ2") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "polkit-qt-1-${POLKITQT-1_VERSION_MAJOR}.${POLKITQT-1_VERSION_MINOR}.${POLKITQT-1_VERSION_PATCH}") +set(CPACK_SOURCE_IGNORE_FILES "/\\\\.svn/" "/\\\\.git/" "makechangelog") + +set(ARCHIVE_NAME ${CPACK_PACKAGE_NAME}-${POLKITQT-1_VERSION_STRING}) +add_custom_target(dist + COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD + | bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2 + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + +include(CPack) # needs to happen after the above variables are set |