You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
polkit-tqt/CMakeLists.txt

135 lines
4.1 KiB

#################################################
#
# (C) 2021 Michele Calgaro
# Michele (DOT) Calgaro (AT) yahoo.it
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
## Polkit TQt Library
project("polkit-tqt")
set(POLKIT-TQT_VERSION_MAJOR 0)
set(POLKIT-TQT_VERSION_MINOR 103)
set(POLKIT-TQT_VERSION_PATCH 0)
set(POLKIT-TQT_VERSION_STRING
"${POLKIT-TQT_VERSION_MAJOR}.${POLKIT-TQT_VERSION_MINOR}.${POLKIT-TQT_VERSION_PATCH}")
##### cmake setup ###############################
cmake_minimum_required( VERSION 2.8.12 )
include( FindPkgConfig )
include( CheckCXXSourceCompiles )
include( CheckSymbolExists )
include( TDEMacros )
enable_testing( )
##### optional stuff
option( WITH_ALL_OPTIONS "Enable all optional support" OFF )
option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} )
##### user requested modules
option( BUILD_ALL "Build all" OFF )
option( BUILD_EXAMPLES "Build examples" ${BUILD_ALL} )
option( BUILD_TESTS "Builds unit tests" ${BUILD_ALL} )
##### configure checks ##########################
include( ConfigureChecks.cmake )
##### install paths setup #######################
tde_setup_install_path( EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" )
tde_setup_install_path( BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" )
tde_setup_install_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" )
tde_setup_install_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/${CMAKE_PROJECT_NAME}" )
tde_setup_install_path( PKGCONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/pkgconfig" )
tde_setup_install_path( SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" )
tde_setup_install_path( DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" )
##### write pkgconfig file ######################
string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_EXEC_PREFIX ${EXEC_INSTALL_PREFIX} )
string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_INCLUDE_DIR ${INCLUDE_INSTALL_DIR} )
string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_LIB_DIR ${LIB_INSTALL_DIR} )
configure_file( polkit-tqt.pc.cmake polkit-tqt.pc @ONLY )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-tqt.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} )
configure_file( polkit-tqt-agent.pc.cmake polkit-tqt-agent.pc @ONLY )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-tqt-agent.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} )
configure_file( polkit-tqt-core.pc.cmake polkit-tqt-core.pc @ONLY )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-tqt-core.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} )
configure_file( polkit-tqt-gui.pc.cmake polkit-tqt-gui.pc @ONLY )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/polkit-tqt-gui.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} )
##### build setup ###############################
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" )
add_definitions(
-DTQT_THREAD_SUPPORT
${TQT_CFLAGS_OTHER}
)
##### source directories ########################
add_subdirectory( core )
add_subdirectory( gui )
add_subdirectory( agent )
tde_conditional_add_subdirectory( BUILD_EXAMPLES examples )
tde_conditional_add_subdirectory( BUILD_TESTS tests )
##### install files #### ########################
install(
FILES
includes/PolkitTQt/Authority
includes/PolkitTQt/Details
includes/PolkitTQt/Identity
includes/PolkitTQt/Subject
includes/PolkitTQt/TemporaryAuthorization
includes/PolkitTQt/ActionDescription
DESTINATION
${INCLUDE_INSTALL_DIR}/PolkitTQt
)
install(
FILES
includes/PolkitTQt/Gui/Action
includes/PolkitTQt/Gui/ActionButton
includes/PolkitTQt/Gui/ActionButtons
DESTINATION
${INCLUDE_INSTALL_DIR}/PolkitTQt/Gui
)
install(
FILES
includes/PolkitTQt/Agent/Listener
includes/PolkitTQt/Agent/Session
DESTINATION
${INCLUDE_INSTALL_DIR}/PolkitTQt/Agent
)
install(
FILES polkit-tqt-export.h
DESTINATION ${INCLUDE_INSTALL_DIR}
)