summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: fc3526b0fbf10e9cd7a0696b6a6639e1f17b16ce (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#################################################
#
#  (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} )


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


##### 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)
add_subdirectory(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
##      ${CMAKE_CURRENT_BINARY_DIR}/polkittqt1-version.h
  DESTINATION
    ${INCLUDE_INSTALL_DIR} )

##
##  include (${TQT_USE_FILE})
##  include (InstallSettings)
##  include (MacroWriteBasicCMakeVersionFile)
##  include (CheckFunctionExists)
##
##  include_directories(
##      ${CMAKE_CURRENT_BINARY_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}
##  )
##
##  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 <package>Config.cmake files to lib/cmake/<package> instead of lib/<package>/cmake" TRUE)
##  endif(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.6.2)
##
##  # The SONUMBER of the polkit-qt-1 libraries
##  set(POLKIT-TQT_ABI_VERSION 1)
##  # The version number of the polkit-qt-1 libraries
##  set(POLKIT-TQT_LIBRARY_VERSION "${POLKIT-TQT_ABI_VERSION}.${POLKIT-TQT_VERSION_MINOR}.${POLKIT-TQT_VERSION_PATCH}")
##
##  configure_file(polkittqt1-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/polkittqt1-version.h)
##
##  install(FILES
##
##      agent/polkittqt1-agent-listener.h
##      agent/polkittqt1-agent-session.h
##
##      ${CMAKE_CURRENT_BINARY_DIR}/polkittqt1-version.h
##      polkit-tqt-export.h
##
##      DESTINATION
##      ${INCLUDE_INSTALL_DIR}/polkit-qt-1 )
##
##
##  # 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
##                                       ${POLKIT-TQT_VERSION_MAJOR} ${POLKIT-TQT_VERSION_MINOR} ${POLKIT-TQT_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)