summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: 5b40d99c0353899d712ea82733f6e3e21e52894d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#################################################
#
#  (C) 2021 Michele Calgaro
#  Michele (DOT) Calgaro (AT) yahoo.it
#
#  Improvements and feedback are welcome
#
#  This file is released under GPL >= 2
#
#################################################


##### set project version ########################

include( TDEVersion )
cmake_minimum_required( VERSION ${TDE_CMAKE_MINIMUM_VERSION} )
tde_set_project_version( )


##### general package setup #####################

project("polkit-tqt")


##### include essential cmake modules ###########

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 ###############################

include( FindPkgConfig )
include( CheckCXXSourceCompiles )
include( CheckSymbolExists )
include( GNUInstallDirs OPTIONAL )
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 )


##### setup install paths #######################

tde_setup_install_path( CMAKE_INSTALL_DIR "${TQT_CMAKE_DIR}" )
if( CMAKE_INSTALL_LIBDIR )
  tde_setup_install_path( LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" )
endif( )

include( TDESetupPaths )
tde_setup_paths( )


##### 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}/${CMAKE_PROJECT_NAME} )
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(
  DIRECTORY includes/
  DESTINATION ${INCLUDE_INSTALL_DIR}/${CMAKE_PROJECT_NAME}
)

install(
  FILES polkit-tqt-export.h
  DESTINATION ${INCLUDE_INSTALL_DIR}/${CMAKE_PROJECT_NAME}
)

tde_install_export( )