## Polkit TQt Library project("PolkitTQt-1") cmake_minimum_required(VERSION 2.6.0) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH}) set(TQT_MIN_VERSION "4.4.0") find_package(Qt4 REQUIRED) find_package(Automoc4 REQUIRED) find_package(Polkit REQUIRED) find_package(GObject REQUIRED) find_package(GIO REQUIRED) add_definitions(-DTQT_NO_KEYWORDS) include (${TQT_USE_FILE}) include (InstallSettings) include (MacroWriteBasicCMakeVersionFile) include (CheckFunctionExists) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${POLKIT_INCLUDE_DIR} ${POLKIT_AGENT_INCLUDE_DIR} ${GLIB2_INCLUDE_DIR} ${GOBJECT_INCLUDE_DIR} ${GIO_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/core ${CMAKE_CURRENT_SOURCE_DIR}/includes ${TQT_TQTXML_INCLUDE_DIR} ) # Check for older polkit set(CMAKE_REQUIRED_INCLUDES ${POLKIT_INCLUDE_DIR} ${POLKIT_AGENT_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${POLKIT_LIBRARIES} ${POLKIT_AGENT_LIBRARY}) check_function_exists(polkit_agent_listener_register HAVE_POLKIT_AGENT_LISTENER_REGISTER) check_function_exists(polkit_authority_get_sync HAVE_POLKIT_AUTHORITY_GET_SYNC) if (NOT HAVE_POLKIT_AGENT_LISTENER_REGISTER OR NOT HAVE_POLKIT_AUTHORITY_GET_SYNC) message(STATUS "You have an older polkit-1 version: Polkit-TQt-1 will be built in compatibility mode") add_definitions(-DPOLKIT_TQT_1_COMPATIBILITY_MODE) endif (NOT HAVE_POLKIT_AGENT_LISTENER_REGISTER OR NOT HAVE_POLKIT_AUTHORITY_GET_SYNC) if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.6.2) option(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR "Prefer to install the Config.cmake files to lib/cmake/ instead of lib//cmake" TRUE) endif(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.6.2) set(POLKITTQT-1_VERSION_MAJOR 0 CACHE INT "PolkitTQt-1's major version number" FORCE) set(POLKITTQT-1_VERSION_MINOR 103 CACHE INT "PolkitTQt-1's minor version number" FORCE) set(POLKITTQT-1_VERSION_PATCH 0 CACHE INT "PolkitTQt-1's release version number" FORCE) set(POLKITTQT-1_VERSION_STRING "${POLKITTQT-1_VERSION_MAJOR}.${POLKITTQT-1_VERSION_MINOR}.${POLKITTQT-1_VERSION_PATCH}") # The SONUMBER of the polkit-qt-1 libraries set(POLKITTQT-1_ABI_VERSION 1) # The version number of the polkit-qt-1 libraries set(POLKITTQT-1_LIBRARY_VERSION "${POLKITTQT-1_ABI_VERSION}.${POLKITTQT-1_VERSION_MINOR}.${POLKITTQT-1_VERSION_PATCH}") configure_file(polkittqt1-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkittqt1-version.h) install(FILES gui/polkittqt1-gui-action.h gui/polkittqt1-gui-actionbutton.h gui/polkittqt1-gui-actionbuttons.h core/polkittqt1-authority.h core/polkittqt1-details.h core/polkittqt1-identity.h core/polkittqt1-subject.h core/polkittqt1-temporaryauthorization.h core/polkittqt1-actiondescription.h agent/polkittqt1-agent-listener.h agent/polkittqt1-agent-session.h ${CMAKE_CURRENT_BINARY_DIR}/polkittqt1-version.h polkittqt1-export.h DESTINATION ${INCLUDE_INSTALL_DIR}/polkit-qt-1 COMPONENT Devel) install(FILES includes/PolkitTQt1/Authority includes/PolkitTQt1/Details includes/PolkitTQt1/Identity includes/PolkitTQt1/Subject includes/PolkitTQt1/TemporaryAuthorization includes/PolkitTQt1/ActionDescription DESTINATION ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitTQt1 COMPONENT Devel) install(FILES includes/PolkitTQt1/Gui/Action includes/PolkitTQt1/Gui/ActionButton includes/PolkitTQt1/Gui/ActionButtons DESTINATION ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitTQt1/Gui COMPONENT Devel) install(FILES includes/PolkitTQt1/Agent/Listener includes/PolkitTQt1/Agent/Session DESTINATION ${INCLUDE_INSTALL_DIR}/polkit-qt-1/PolkitTQt1/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) # CMake Config files configure_file(PolkitTQt-1Config.cmake.in "${CMAKE_BINARY_DIR}/PolkitTQt-1Config.cmake" @ONLY) # this file is used by to check if the installed version can be used. macro_write_basic_cmake_version_file(${CMAKE_BINARY_DIR}/PolkitTQt-1ConfigVersion.cmake ${POLKITTQT-1_VERSION_MAJOR} ${POLKITTQT-1_VERSION_MINOR} ${POLKITTQT-1_VERSION_PATCH}) if(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR) set(_PolkitTQt-1Config_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/PolkitTQt-1) else(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR) set(_PolkitTQt-1Config_INSTALL_DIR ${LIB_INSTALL_DIR}/PolkitTQt-1/cmake) endif(USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR) install(FILES ${CMAKE_BINARY_DIR}/PolkitTQt-1ConfigVersion.cmake ${CMAKE_BINARY_DIR}/PolkitTQt-1Config.cmake DESTINATION ${_PolkitTQt-1Config_INSTALL_DIR} ) option(BUILD_EXAMPLES "Builds a set of examples for polkit-qt-1" OFF) if (BUILD_EXAMPLES) add_subdirectory(examples) endif (BUILD_EXAMPLES) 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) # Always last! include (PolkitTQt-1Dist)