Shared cmake folder
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.

2817 lines
87 KiB

  1. #################################################
  2. #
  3. # (C) 2010-2012 Serghei Amelian
  4. # serghei (DOT) amelian (AT) gmail.com
  5. #
  6. # (C) 2011-2012 Timothy Pearson
  7. # kb9vqf (AT) pearsoncomputing.net
  8. #
  9. # (C) 2012-2020 Slávek Banko
  10. # slavek (DOT) banko (AT) axis.cz
  11. #
  12. # Improvements and feedback are welcome
  13. #
  14. # This file is released under GPL >= 2
  15. #
  16. #################################################
  17. include( CheckCXXCompilerFlag )
  18. #################################################
  19. #####
  20. ##### initialization...
  21. if( NOT TDE_CMAKE_ROOT )
  22. if( ${CMAKE_CURRENT_LIST_DIR} STREQUAL ${CMAKE_ROOT}/Modules )
  23. # TDE CMake is installed in the system directory
  24. set( TDE_CMAKE_ROOT ${CMAKE_ROOT}
  25. CACHE FILEPATH "TDE CMake root" )
  26. set( TDE_CMAKE_TEMPLATES ${TDE_CMAKE_ROOT}/Templates
  27. CACHE FILEPATH "TDE CMake templates" )
  28. else()
  29. # TDE CMake is part of the source code
  30. get_filename_component( TDE_CMAKE_ROOT ${CMAKE_CURRENT_LIST_DIR} PATH )
  31. set( TDE_CMAKE_ROOT ${TDE_CMAKE_ROOT}
  32. CACHE FILEPATH "TDE CMake root" )
  33. set( TDE_CMAKE_TEMPLATES ${TDE_CMAKE_ROOT}/templates
  34. CACHE FILEPATH "TDE CMake templates" )
  35. endif()
  36. option( FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." FALSE )
  37. if( ${FORCE_COLORED_OUTPUT} )
  38. if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" )
  39. if( NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9" )
  40. add_compile_options (-fdiagnostics-color=always)
  41. endif()
  42. elseif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
  43. add_compile_options (-fcolor-diagnostics)
  44. endif()
  45. endif()
  46. endif()
  47. #################################################
  48. #####
  49. ##### tde_message_fatal
  50. macro( tde_message_fatal )
  51. message( FATAL_ERROR
  52. "#################################################\n"
  53. " ${ARGV}\n"
  54. "#################################################" )
  55. endmacro( tde_message_fatal )
  56. #################################################
  57. #####
  58. ##### tde_get_arg( <ARG_NAME> <COUNT> <RETURN> <REST> <ARGS...> )
  59. ##### ARG_NAME(string): name of an argument to find in ARGS
  60. ##### COUNT(number): argument dimension, a number of items returned in RETURN
  61. ##### RETURN(list ref): items returned for argument as they found in ARGS
  62. ##### REST(list ref): rest of items except argument name and items returned in RETURN
  63. ##### ARGS(list): source list of arguments
  64. macro( tde_get_arg ARG_NAME COUNT RETURN REST )
  65. unset( ${RETURN} )
  66. unset( ${REST} )
  67. list( APPEND ${REST} ${ARGN} )
  68. list( FIND ${REST} ${ARG_NAME} _arg_idx)
  69. if( NOT ${_arg_idx} EQUAL -1 )
  70. list( REMOVE_AT ${REST} ${_arg_idx} )
  71. set( _i 0 )
  72. while( ${_i} LESS ${COUNT} )
  73. list( GET ${REST} ${_arg_idx} _arg )
  74. list( REMOVE_AT ${REST} ${_arg_idx} )
  75. list( APPEND ${RETURN} ${_arg} )
  76. math( EXPR _i "${_i} + 1" )
  77. endwhile()
  78. endif()
  79. endmacro( tde_get_arg )
  80. ################################################
  81. #####
  82. ##### tde_execute_process( <ARGS...> [MESSAGE <MSG>] )
  83. ##### MSG: fatal error message (standard message will be written if not supplied)
  84. ##### ARGS: execute_process arguments
  85. macro( tde_execute_process )
  86. tde_get_arg( MESSAGE 1 _message _rest_args ${ARGV} )
  87. tde_get_arg( RESULT_VARIABLE 1 _result_variable _tmp ${_rest_args} )
  88. tde_get_arg( COMMAND 1 _command _tmp ${_rest_args} )
  89. tde_get_arg( OUTPUT_VARIABLE 1 _output_variable _tmp ${_rest_args} )
  90. tde_get_arg( CACHE 3 _cache _rest_args2 ${_rest_args} )
  91. # handle optional FORCE parameter
  92. if( DEFINED _cache )
  93. list( GET _cache 2 _tmp )
  94. if( _tmp STREQUAL FORCE )
  95. set( _rest_args ${_rest_args2} )
  96. else()
  97. tde_get_arg( CACHE 2 _cache _rest_args ${_rest_args} )
  98. endif()
  99. endif()
  100. if( NOT DEFINED _result_variable )
  101. list( APPEND _rest_args RESULT_VARIABLE _exec_result )
  102. set( _result_variable _exec_result )
  103. endif()
  104. execute_process( ${_rest_args} )
  105. if( DEFINED _output_variable AND DEFINED _cache )
  106. set( ${_output_variable} ${${_output_variable}} CACHE ${_cache} )
  107. endif()
  108. if( ${_result_variable} )
  109. if( DEFINED _message )
  110. tde_message_fatal( ${_message} )
  111. else()
  112. if( ${${_result_variable}} MATCHES "^[0-9]+$" )
  113. set( ${_result_variable} "status ${${_result_variable}} returned!" )
  114. endif()
  115. tde_message_fatal( "Error executing '${_command}': ${${_result_variable}}" )
  116. endif()
  117. endif()
  118. endmacro( tde_execute_process )
  119. ################################################
  120. #####
  121. ##### tde_read_src_metadata
  122. macro( tde_read_src_metadata )
  123. # look for SCM data if present
  124. if( EXISTS "${CMAKE_SOURCE_DIR}/.tdescminfo" )
  125. file( READ "${CMAKE_SOURCE_DIR}/.tdescminfo" TDE_SCM_INFO )
  126. string( REGEX MATCH "(^|\n)Name: ([^\n]*)" TDE_SCM_MODULE_NAME "${TDE_SCM_INFO}" )
  127. string( REGEX REPLACE "^[^:]*: " "" TDE_SCM_MODULE_NAME "${TDE_SCM_MODULE_NAME}" )
  128. string( REGEX MATCH "(^|\n)Revision: ([^\n]*)" TDE_SCM_MODULE_REVISION "${TDE_SCM_INFO}" )
  129. string( REGEX REPLACE "^[^:]*: " "" TDE_SCM_MODULE_REVISION "${TDE_SCM_MODULE_REVISION}" )
  130. string( REGEX MATCH "(^|\n)DateTime: ([^\n]*)" TDE_SCM_MODULE_DATETIME "${TDE_SCM_INFO}" )
  131. string( REGEX REPLACE "^[^:]*: " "" TDE_SCM_MODULE_DATETIME "${TDE_SCM_MODULE_DATETIME}" )
  132. else( )
  133. if( EXISTS "${CMAKE_SOURCE_DIR}/.tdescmmodule" )
  134. file( STRINGS "${CMAKE_SOURCE_DIR}/.tdescmmodule" TDE_SCM_MODULE_NAME )
  135. endif( EXISTS "${CMAKE_SOURCE_DIR}/.tdescmmodule" )
  136. if( EXISTS "${CMAKE_SOURCE_DIR}/.tdescmrevision" )
  137. file( STRINGS "${CMAKE_SOURCE_DIR}/.tdescmrevision" TDE_SCM_MODULE_REVISION )
  138. endif( EXISTS "${CMAKE_SOURCE_DIR}/.tdescmrevision" )
  139. endif( )
  140. # look for package data if present
  141. if( EXISTS "${CMAKE_SOURCE_DIR}/.tdepkginfo" )
  142. file( READ "${CMAKE_SOURCE_DIR}/.tdepkginfo" TDE_PKG_INFO )
  143. endif( )
  144. if( EXISTS "${CMAKE_BINARY_DIR}/.tdepkginfo" )
  145. file( READ "${CMAKE_BINARY_DIR}/.tdepkginfo" TDE_PKG_INFO )
  146. endif( )
  147. if( TDE_PKG_INFO )
  148. string( REGEX MATCH "(^|\n)Name: ([^\n]*)" TDE_PKG_NAME "${TDE_PKG_INFO}" )
  149. string( REGEX REPLACE "^[^:]*: " "" TDE_PKG_NAME "${TDE_PKG_NAME}" )
  150. string( REGEX MATCH "(^|\n)Version: ([^\n]*)" TDE_PKG_VERSION "${TDE_PKG_INFO}" )
  151. string( REGEX REPLACE "^[^:]*: " "" TDE_PKG_VERSION "${TDE_PKG_VERSION}" )
  152. string( REGEX MATCH "(^|\n)DateTime: ([^\n]*)" TDE_PKG_DATETIME "${TDE_PKG_INFO}" )
  153. string( REGEX REPLACE "^[^:]*: " "" TDE_PKG_DATETIME "${TDE_PKG_DATETIME}" )
  154. endif( )
  155. endmacro( tde_read_src_metadata )
  156. if( DEFINED MASTER_SOURCE_DIR )
  157. return( )
  158. endif( )
  159. ########### slave part ends here ###############
  160. ################################################
  161. #####
  162. ##### tde_install_icons( <icons...> THEME <svgicons> DESTINATION <destdir> )
  163. ##### default theme: hicolor
  164. ##### default destination: ${SHARE_INSTALL_DIR}/icons
  165. macro( tde_install_icons )
  166. tde_get_arg( DESTINATION 1 _dest _args ${ARGV} )
  167. tde_get_arg( THEME 1 _req_theme _icons ${_args} )
  168. #defaults
  169. if( NOT _icons )
  170. set( _icons "*" )
  171. endif( NOT _icons )
  172. if( NOT _dest )
  173. set( _dest "${ICON_INSTALL_DIR}" )
  174. endif( NOT _dest )
  175. foreach( _icon ${_icons} )
  176. unset( _theme ) # clearing
  177. file(GLOB _icon_files *-${_icon}.png *-${_icon}.mng _icon_files *-${_icon}.svg* )
  178. foreach( _icon_file ${_icon_files} )
  179. # FIXME need a review
  180. string( REGEX MATCH "^.*/([a-zA-Z][a-zA-Z])([0-9a-zA-Z]+)\\-([a-z]+)\\-([^/]+)$" _dummy "${_icon_file}" )
  181. set( _type "${CMAKE_MATCH_1}" )
  182. set( _size "${CMAKE_MATCH_2}" )
  183. set( _group "${CMAKE_MATCH_3}" )
  184. set( _name "${CMAKE_MATCH_4}" )
  185. # we must ignore invalid icon names
  186. if( _type AND _size AND _group AND _name )
  187. # autodetect theme
  188. if( NOT _req_theme )
  189. unset( _theme )
  190. if( "${_type}" STREQUAL "cr" )
  191. set( _theme crystalsvg )
  192. elseif( "${_type}" STREQUAL "lo" )
  193. set( _theme locolor )
  194. endif( "${_type}" STREQUAL "cr" )
  195. # defaulting
  196. if( NOT _theme )
  197. set( _theme hicolor )
  198. endif( NOT _theme )
  199. else( NOT _req_theme )
  200. set( _theme ${_req_theme} )
  201. endif( NOT _req_theme )
  202. # fix "group" name
  203. if( "${_group}" STREQUAL "mime" )
  204. set( _group "mimetypes" )
  205. endif( "${_group}" STREQUAL "mime" )
  206. if( "${_group}" STREQUAL "filesys" )
  207. set( _group "places" )
  208. endif( "${_group}" STREQUAL "filesys" )
  209. if( "${_group}" STREQUAL "category" )
  210. set( _group "categories" )
  211. endif( "${_group}" STREQUAL "category" )
  212. if( "${_group}" STREQUAL "device" )
  213. set( _group "devices" )
  214. endif( "${_group}" STREQUAL "device" )
  215. if( "${_group}" STREQUAL "app" )
  216. set( _group "apps" )
  217. endif( "${_group}" STREQUAL "app" )
  218. if( "${_group}" STREQUAL "action" )
  219. set( _group "actions" )
  220. endif( "${_group}" STREQUAL "action" )
  221. if( "${_size}" STREQUAL "sc" )
  222. install( FILES ${_icon_file} DESTINATION ${_dest}/${_theme}/scalable/${_group}/ RENAME ${_name} )
  223. else( "${_size}" STREQUAL "sc" )
  224. install( FILES ${_icon_file} DESTINATION ${_dest}/${_theme}/${_size}x${_size}/${_group}/ RENAME ${_name} )
  225. endif( "${_size}" STREQUAL "sc" )
  226. endif( _type AND _size AND _group AND _name )
  227. endforeach( _icon_file )
  228. endforeach( _icon )
  229. endmacro( tde_install_icons )
  230. #################################################
  231. #####
  232. ##### tde_add_lut( <source> <result> [depends] )
  233. ##### default depends: source
  234. macro( tde_add_lut _src _lut _dep )
  235. set( create_hash_table ${CMAKE_SOURCE_DIR}/kjs/create_hash_table )
  236. if( NOT _dep )
  237. set( _dep ${_src} )
  238. endif( NOT _dep )
  239. add_custom_command( OUTPUT ${_lut}
  240. COMMAND perl ARGS ${create_hash_table} ${CMAKE_CURRENT_SOURCE_DIR}/${_src} -i > ${_lut}
  241. DEPENDS ${_src} )
  242. set_source_files_properties( ${_dep} PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_lut} )
  243. unset( _dep )
  244. endmacro( tde_add_lut )
  245. #################################################
  246. #####
  247. ##### tde_add_luts( <sources...> )
  248. macro( tde_add_luts )
  249. foreach( _src ${ARGV} )
  250. get_filename_component( _lut ${_src} NAME_WE )
  251. set( _lut "${_lut}.lut.h" )
  252. tde_add_lut( ${_src} ${_lut} ${_src} )
  253. endforeach( _src )
  254. endmacro( tde_add_luts )
  255. #################################################
  256. #####
  257. ##### tde_file_to_cpp( <source> <destination> <variable> )
  258. macro( tde_file_to_cpp _src _dst _var )
  259. if( IS_ABSOLUTE ${_dst} )
  260. set( dst ${_dst} )
  261. else( )
  262. set( dst "${CMAKE_CURRENT_BINARY_DIR}/${_dst}" )
  263. endif( )
  264. file( READ ${_src} text )
  265. string( REGEX REPLACE "\n" "\\\\n\"\n\"" text "${text}" )
  266. set( text "/* Generated by CMake */\n\nconst char *${_var} = \n\n\"${text}\";\n" )
  267. string( REGEX REPLACE "\n\"\";\n$" ";\n" text "${text}" )
  268. file( WRITE ${dst} "${text}" )
  269. endmacro( )
  270. #################################################
  271. #####
  272. ##### tde_get_library_filename( <var> <target> )
  273. function( tde_get_library_filename _filename _target )
  274. get_target_property( _type ${_target} TYPE )
  275. if( "${_type}" MATCHES "_LIBRARY" )
  276. get_target_property( _output_prefix ${_target} PREFIX )
  277. if( "${_output_prefix}" STREQUAL "_output_prefix-NOTFOUND" )
  278. if( "${_type}" MATCHES "STATIC_" )
  279. set( _output_prefix "${CMAKE_STATIC_LIBRARY_PREFIX}" )
  280. elseif( "${_type}" MATCHES "SHARED_" )
  281. set( _output_prefix "${CMAKE_SHARED_LIBRARY_PREFIX}" )
  282. elseif( "${_type}" MATCHES "MODULE_" )
  283. set( _output_prefix "${CMAKE_SHARED_MODULE_PREFIX}" )
  284. else( )
  285. set( _output_prefix "" )
  286. endif( )
  287. endif( )
  288. get_target_property( _output_suffix ${_target} SUFFIX )
  289. if( "${_output_suffix}" STREQUAL "_output_suffix-NOTFOUND" )
  290. if( "${_type}" MATCHES "STATIC_" )
  291. set( _output_suffix "${CMAKE_STATIC_LIBRARY_SUFFIX}" )
  292. elseif( "${_type}" MATCHES "SHARED_" )
  293. set( _output_suffix "${CMAKE_SHARED_LIBRARY_SUFFIX}" )
  294. elseif( "${_type}" MATCHES "MODULE_" )
  295. set( _output_suffix "${CMAKE_SHARED_MODULE_SUFFIX}" )
  296. else( )
  297. set( _output_suffix "" )
  298. endif( )
  299. endif( )
  300. get_target_property( _output ${_target} OUTPUT_NAME )
  301. set( ${_filename} "${_output_prefix}${_output}${_output_suffix}" PARENT_SCOPE )
  302. else( )
  303. set( ${_filename} "" PARENT_SCOPE )
  304. endif( )
  305. endfunction( )
  306. #################################################
  307. #####
  308. ##### tde_install_la_file( <target> <destination> )
  309. macro( tde_install_la_file _target _destination )
  310. tde_get_library_filename( _soname ${_target} )
  311. get_target_property( _target_release ${_target} RELEASE )
  312. if( _target_release )
  313. string( REPLACE "-${_target_release}" "" _soname_base "${_soname}" )
  314. else( )
  315. set( _soname_base ${_soname} )
  316. endif( )
  317. string( REGEX REPLACE "\\.so(\\.[0-9]+)*$" "" _laname "${_soname_base}" )
  318. set( _laname ${CMAKE_CURRENT_BINARY_DIR}/${_laname}.la )
  319. file( WRITE ${_laname}
  320. "# ${_laname} - a libtool library file, generated by cmake
  321. # The name that we can dlopen(3).
  322. dlname='${_soname}'
  323. # Names of this library
  324. library_names='${_soname} ${_soname} ${_soname_base}'
  325. # The name of the static archive
  326. old_library=''
  327. # Libraries that this one depends upon.
  328. dependency_libs=''
  329. # Version information.\ncurrent=0\nage=0\nrevision=0
  330. # Is this an already installed library?\ninstalled=yes
  331. # Should we warn about portability when linking against -modules?\nshouldnotlink=yes
  332. # Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen=''
  333. # Directory that this library needs to be installed in:
  334. libdir='${_destination}'
  335. " )
  336. install( FILES ${_laname} DESTINATION ${_destination} )
  337. endmacro( tde_install_la_file )
  338. #################################################
  339. #####
  340. ##### tde_add_ui_files
  341. macro( tde_add_ui_files _sources )
  342. foreach( _ui_file ${ARGN} )
  343. get_filename_component( _ui_basename ${_ui_file} NAME_WE )
  344. get_filename_component( _ui_absolute_path ${_ui_file} ABSOLUTE )
  345. list( APPEND ${_sources} ${_ui_basename}.cpp )
  346. add_custom_command( OUTPUT ${_ui_basename}.h ${_ui_basename}.cpp
  347. COMMAND ${CMAKE_COMMAND}
  348. -DUIC_EXECUTABLE:FILEPATH=${UIC_EXECUTABLE}
  349. -DTQT_REPLACE_SCRIPT:FILEPATH=${TQT_REPLACE_SCRIPT}
  350. -DTDE_TQTPLUGINS_DIR:FILEPATH=${TDE_TQTPLUGINS_DIR}
  351. -DMOC_EXECUTABLE:FILEPATH=${MOC_EXECUTABLE}
  352. -DUI_FILE:FILEPATH=${_ui_absolute_path}
  353. -DMASTER_SOURCE_DIR:FILEPATH=${CMAKE_SOURCE_DIR}
  354. -DMASTER_BINARY_DIR:FILEPATH=${CMAKE_BINARY_DIR}
  355. -P ${CMAKE_MODULE_PATH}/tde_uic.cmake
  356. DEPENDS ${_ui_absolute_path} )
  357. endforeach( _ui_file )
  358. endmacro( tde_add_ui_files )
  359. #################################################
  360. #####
  361. ##### tde_moc
  362. macro( tde_moc _sources )
  363. foreach( _input_file ${ARGN} )
  364. get_filename_component( _input_file "${_input_file}" ABSOLUTE )
  365. get_filename_component( _basename ${_input_file} NAME_WE )
  366. set( _output_file "${_basename}.moc.cpp" )
  367. add_custom_command( OUTPUT ${_output_file}
  368. COMMAND
  369. ${TMOC_EXECUTABLE} ${_input_file} -o ${_output_file}
  370. DEPENDS
  371. ${_input_file} )
  372. list( APPEND ${_sources} ${_output_file} )
  373. endforeach( )
  374. endmacro( )
  375. #################################################
  376. #####
  377. ##### tde_automoc
  378. macro( tde_automoc )
  379. foreach( _src_file ${ARGN} )
  380. get_filename_component( _src_file "${_src_file}" ABSOLUTE )
  381. if( EXISTS "${_src_file}" )
  382. # read source file and check if have moc include
  383. file( READ "${_src_file}" _src_content )
  384. string( REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _moc_includes "${_src_content}" )
  385. # found included moc(s)?
  386. if( _moc_includes )
  387. foreach( _moc_file ${_moc_includes} )
  388. # extracting moc filename
  389. string( REGEX MATCH "[^ <\"]+\\.moc" _moc_file "${_moc_file}" )
  390. set( _moc_file "${CMAKE_CURRENT_BINARY_DIR}/${_moc_file}" )
  391. # create header filename
  392. get_filename_component( _src_path "${_src_file}" ABSOLUTE )
  393. get_filename_component( _src_path "${_src_path}" PATH )
  394. get_filename_component( _src_header "${_moc_file}" NAME_WE )
  395. set( _header_file "${_src_path}/${_src_header}.h" )
  396. # if header doesn't exists, check in META_INCLUDES
  397. if( NOT EXISTS "${_header_file}" )
  398. unset( _found )
  399. foreach( _src_path ${_meta_includes} )
  400. set( _header_file "${_src_path}/${_src_header}.h" )
  401. if( EXISTS "${_header_file}" )
  402. set( _found 1 )
  403. break( )
  404. endif( )
  405. endforeach( )
  406. if( NOT _found )
  407. get_filename_component( _moc_file "${_moc_file}" NAME )
  408. tde_message_fatal( "AUTOMOC error: '${_moc_file}' cannot be generated.\n Reason: '${_src_file}.h' not found." )
  409. endif( )
  410. endif( )
  411. # moc-ing header
  412. add_custom_command( OUTPUT ${_moc_file}
  413. COMMAND ${TMOC_EXECUTABLE} ${_header_file} -o ${_moc_file}
  414. DEPENDS ${_header_file} )
  415. # create dependency between source file and moc file
  416. set_property( SOURCE ${_src_file} APPEND PROPERTY OBJECT_DEPENDS ${_moc_file} )
  417. endforeach( _moc_file )
  418. endif( _moc_includes )
  419. endif( EXISTS "${_src_file}" )
  420. endforeach( _src_file )
  421. endmacro( tde_automoc )
  422. #################################################
  423. #####
  424. ##### tde_create_dcop_kidl
  425. macro( tde_create_dcop_kidl _kidl _kidl_source )
  426. get_filename_component( _kidl_source ${_kidl_source} ABSOLUTE )
  427. get_filename_component( _kidl_basename ${_kidl_source} NAME_WE )
  428. set( _kidl_output ${CMAKE_CURRENT_BINARY_DIR}/${_kidl_basename}.kidl )
  429. file( RELATIVE_PATH _kidl_target "${CMAKE_BINARY_DIR}" "${_kidl_output}" )
  430. string( REPLACE "/" "+" _kidl_target "${_kidl_target}" )
  431. if( NOT TARGET ${_kidl_target} )
  432. add_custom_command(
  433. OUTPUT ${_kidl_output}
  434. COMMAND ${KDE3_DCOPIDLNG_EXECUTABLE}
  435. ARGS ${_kidl_source} > ${_kidl_output}
  436. DEPENDS ${_kidl_source}
  437. )
  438. add_custom_target( ${_kidl_target} DEPENDS ${_kidl_output} )
  439. endif( )
  440. set( ${_kidl} ${_kidl_output} )
  441. endmacro( tde_create_dcop_kidl )
  442. #################################################
  443. #####
  444. ##### tde_add_dcop_skels
  445. macro( tde_add_dcop_skels _sources )
  446. foreach( _current_FILE ${ARGN} )
  447. get_filename_component( _tmp_FILE ${_current_FILE} ABSOLUTE )
  448. get_filename_component( _basename ${_tmp_FILE} NAME_WE )
  449. set( _skel ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_skel.cpp )
  450. file( RELATIVE_PATH _skel_target "${CMAKE_BINARY_DIR}" "${_skel}" )
  451. string( REPLACE "/" "+" _skel_target "${_skel_target}" )
  452. tde_create_dcop_kidl( _kidl ${_tmp_FILE} )
  453. if( NOT TARGET ${_skel_target} )
  454. add_custom_command(
  455. OUTPUT ${_skel}
  456. COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE}
  457. ARGS --c++-suffix cpp --no-signals --no-stub ${_kidl}
  458. DEPENDS ${_kidl_target}
  459. )
  460. add_custom_target( ${_skel_target} DEPENDS ${_skel} )
  461. endif( )
  462. list( APPEND ${_sources} ${_skel} )
  463. endforeach( _current_FILE )
  464. endmacro( tde_add_dcop_skels )
  465. #################################################
  466. #####
  467. ##### tde_add_dcop_stubs
  468. macro( tde_add_dcop_stubs _sources )
  469. foreach( _current_FILE ${ARGN} )
  470. get_filename_component( _tmp_FILE ${_current_FILE} ABSOLUTE )
  471. get_filename_component( _basename ${_tmp_FILE} NAME_WE )
  472. set( _stub_CPP ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_stub.cpp )
  473. set( _stub_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_stub.h )
  474. file( RELATIVE_PATH _stub_target "${CMAKE_BINARY_DIR}" "${_stub_CPP}" )
  475. string( REPLACE "/" "+" _stub_target "${_stub_target}" )
  476. tde_create_dcop_kidl( _kidl ${_tmp_FILE} )
  477. if( NOT TARGET ${_stub_target} )
  478. add_custom_command(
  479. OUTPUT ${_stub_CPP} ${_stub_HEADER}
  480. COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE}
  481. ARGS --c++-suffix cpp --no-signals --no-skel ${_kidl}
  482. DEPENDS ${_kidl_target}
  483. )
  484. add_custom_target( ${_stub_target} DEPENDS ${_stub_CPP} ${_stub_HEADER} )
  485. endif( )
  486. list( APPEND ${_sources} ${_stub_CPP} )
  487. endforeach( _current_FILE )
  488. endmacro( tde_add_dcop_stubs )
  489. #################################################
  490. #####
  491. ##### tde_add_kcfg_files
  492. macro( tde_add_kcfg_files _sources )
  493. foreach( _current_FILE ${ARGN} )
  494. get_filename_component( _tmp_FILE ${_current_FILE} ABSOLUTE )
  495. get_filename_component( _basename ${_tmp_FILE} NAME_WE )
  496. file( READ ${_tmp_FILE} _contents )
  497. string( REGEX REPLACE "^(.*\n)?File=([^\n]+)\n.*$" "\\2" _kcfg_FILE "${_contents}" )
  498. set( _src_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp )
  499. set( _header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h )
  500. file( RELATIVE_PATH _kcfg_target "${CMAKE_BINARY_DIR}" "${_src_FILE}" )
  501. string( REPLACE "/" "+" _kcfg_target "${_kcfg_target}" )
  502. if( NOT TARGET ${_kcfg_target} )
  503. add_custom_command(
  504. OUTPUT ${_src_FILE} ${_header_FILE}
  505. COMMAND ${KDE3_KCFGC_EXECUTABLE}
  506. ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} ${_tmp_FILE}
  507. DEPENDS ${_tmp_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE}
  508. )
  509. add_custom_target( ${_kcfg_target} DEPENDS ${_src_FILE} ${_header_FILE} )
  510. endif( )
  511. list( APPEND ${_sources} ${_src_FILE} )
  512. endforeach( _current_FILE )
  513. endmacro( tde_add_kcfg_files )
  514. #################################################
  515. #####
  516. ##### __tde_internal_process_sources
  517. macro( __tde_internal_process_sources _sources )
  518. unset( ${_sources} )
  519. foreach( _arg ${ARGN} )
  520. get_filename_component( _ext ${_arg} EXT )
  521. get_filename_component( _name ${_arg} NAME_WE )
  522. get_filename_component( _path ${_arg} PATH )
  523. # if not path, set it to "."
  524. if( NOT _path )
  525. set( _path "./" )
  526. endif( NOT _path )
  527. # handle .ui files
  528. if( ${_ext} STREQUAL ".ui" )
  529. tde_add_ui_files( ${_sources} ${_arg} )
  530. # handle .skel files
  531. elseif( ${_ext} STREQUAL ".skel" )
  532. tde_add_dcop_skels( ${_sources} ${_path}/${_name}.h )
  533. # handle .stub files
  534. elseif( ${_ext} STREQUAL ".stub" )
  535. tde_add_dcop_stubs( ${_sources} ${_path}/${_name}.h )
  536. # handle .kcfgc files
  537. elseif( ${_ext} STREQUAL ".kcfgc" )
  538. tde_add_kcfg_files( ${_sources} ${_arg} )
  539. # handle any other files
  540. else( ${_ext} STREQUAL ".ui" )
  541. list(APPEND ${_sources} ${_arg} )
  542. endif( ${_ext} STREQUAL ".ui" )
  543. endforeach( _arg )
  544. endmacro( __tde_internal_process_sources )
  545. #################################################
  546. #####
  547. ##### tde_install_libtool_file
  548. macro( tde_install_libtool_file _target _destination )
  549. # get .so name
  550. tde_get_library_filename( _soname ${_target} )
  551. get_target_property( _target_release ${_target} RELEASE )
  552. if( _target_release )
  553. string( REPLACE "-${_target_release}" "" _soname_base "${_soname}" )
  554. else( )
  555. set( _soname_base ${_soname} )
  556. endif( )
  557. # get .la name
  558. string( REGEX REPLACE "\\.so(\\.[0-9]+)*$" "" _laname "${_soname_base}" )
  559. set( _laname ${_laname}.la )
  560. # get version of target
  561. get_target_property( _target_version ${_target} VERSION )
  562. get_target_property( _target_soversion ${_target} SOVERSION )
  563. # we have so version
  564. if( _target_version )
  565. set( _library_name_1 "${_soname}.${_target_version}" )
  566. set( _library_name_2 "${_soname}.${_target_soversion}" )
  567. set( _library_name_3 "${_soname_base}" )
  568. string( REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" _dummy "${_target_version}" )
  569. set( _version_current "${CMAKE_MATCH_1}" )
  570. set( _version_age "${CMAKE_MATCH_2}" )
  571. set( _version_revision "${CMAKE_MATCH_3}" )
  572. # we have no so version (module?)
  573. else( _target_version )
  574. set( _library_name_1 "${_soname}" )
  575. set( _library_name_2 "${_soname}" )
  576. set( _library_name_3 "${_soname_base}" )
  577. set( _version_current "0" )
  578. set( _version_age "0" )
  579. set( _version_revision "0" )
  580. endif( _target_version )
  581. if( IS_ABSOLUTE ${_destination} )
  582. set( _libdir "${_destination}" )
  583. else( IS_ABSOLUTE ${_destination} )
  584. set( _libdir "${CMAKE_INSTALL_PREFIX}/${_destination}" )
  585. endif( IS_ABSOLUTE ${_destination} )
  586. configure_file( ${TDE_CMAKE_TEMPLATES}/tde_libtool_file.cmake "${_laname}" @ONLY )
  587. install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${_laname}" DESTINATION ${_destination} )
  588. endmacro( tde_install_libtool_file )
  589. #################################################
  590. #####
  591. ##### tde_install_export / tde_import
  592. function( tde_install_export )
  593. file( GLOB export_files ${CMAKE_CURRENT_BINARY_DIR}/export-*.cmake )
  594. set( mode "WRITE" )
  595. foreach( filename ${export_files} )
  596. file( READ ${filename} content )
  597. file( ${mode} "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.cmake" "${content}" )
  598. set( mode "APPEND" )
  599. endforeach( )
  600. install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.cmake" DESTINATION ${CMAKE_INSTALL_DIR} )
  601. endfunction( )
  602. macro( tde_import _library )
  603. message( STATUS "checking for '${_library}'" )
  604. string( TOUPPER "BUILD_${_library}" _build )
  605. if( ${_build} )
  606. message( STATUS " ok, activated for build" )
  607. else()
  608. if( EXISTS "${TDE_CMAKE_DIR}/${_library}.cmake" )
  609. include( "${TDE_CMAKE_DIR}/${_library}.cmake" )
  610. message( STATUS " ok, found import file" )
  611. else()
  612. tde_message_fatal( "'${_library}' are required,\n but is not installed nor selected for build" )
  613. endif()
  614. endif()
  615. endmacro()
  616. #################################################
  617. #####
  618. ##### tde_add_library
  619. macro( tde_add_library _arg_target )
  620. unset( _target )
  621. unset( _type )
  622. unset( _static_pic )
  623. unset( _automoc )
  624. unset( _meta_includes )
  625. unset( _no_libtool_file )
  626. unset( _no_export )
  627. unset( _version )
  628. unset( _release )
  629. unset( _sources )
  630. unset( _destination )
  631. unset( _embed )
  632. unset( _link )
  633. unset( _link_private )
  634. unset( _dependencies )
  635. unset( _storage )
  636. unset( _exclude_from_all )
  637. set( _shouldnotlink no )
  638. # metadata
  639. unset( _description )
  640. unset( _license )
  641. unset( _copyright )
  642. unset( _authors )
  643. unset( _product )
  644. unset( _organization )
  645. unset( _version )
  646. unset( _datetime )
  647. unset( _notes )
  648. # default metadata
  649. set( _product "Trinity Desktop Environment" )
  650. tde_curdatetime( _datetime )
  651. foreach( _arg ${ARGV} )
  652. # this variable help us to skip
  653. # storing unapropriate values (i.e. directives)
  654. unset( _skip_store )
  655. # found one of directives: "SHARED", "STATIC", "MODULE"
  656. if( "+${_arg}" STREQUAL "+SHARED" OR "+${_arg}" STREQUAL "+STATIC" OR "+${_arg}" STREQUAL "+MODULE" )
  657. set( _skip_store 1 )
  658. set( _type "${_arg}" )
  659. endif( "+${_arg}" STREQUAL "+SHARED" OR "+${_arg}" STREQUAL "+STATIC" OR "+${_arg}" STREQUAL "+MODULE" )
  660. # found directive "STATIC_PIC"
  661. if( "+${_arg}" STREQUAL "+STATIC_PIC" )
  662. set( _skip_store 1 )
  663. set( _type "STATIC" )
  664. set( _static_pic 1 )
  665. endif( "+${_arg}" STREQUAL "+STATIC_PIC" )
  666. # found directive "AUTOMOC"
  667. if( "+${_arg}" STREQUAL "+AUTOMOC" )
  668. set( _skip_store 1 )
  669. set( _automoc 1 )
  670. endif( "+${_arg}" STREQUAL "+AUTOMOC" )
  671. # found directive "META_INCLUDES"
  672. if( "+${_arg}" STREQUAL "+META_INCLUDES" )
  673. set( _skip_store 1 )
  674. set( _storage "_meta_includes" )
  675. endif( )
  676. # found directive "NO_LIBTOOL_FILE"
  677. if( "+${_arg}" STREQUAL "+NO_LIBTOOL_FILE" )
  678. set( _skip_store 1 )
  679. set( _no_libtool_file 1 )
  680. endif( "+${_arg}" STREQUAL "+NO_LIBTOOL_FILE" )
  681. # found directive "NO_EXPORT"
  682. if( "+${_arg}" STREQUAL "+NO_EXPORT" )
  683. set( _skip_store 1 )
  684. set( _no_export 1 )
  685. endif( "+${_arg}" STREQUAL "+NO_EXPORT" )
  686. # found directive "VERSION"
  687. if( "+${_arg}" STREQUAL "+VERSION" )
  688. set( _skip_store 1 )
  689. set( _storage "_version" )
  690. endif( "+${_arg}" STREQUAL "+VERSION" )
  691. # found directive "RELEASE"
  692. if( "+${_arg}" STREQUAL "+RELEASE" )
  693. set( _skip_store 1 )
  694. set( _storage "_release" )
  695. endif( "+${_arg}" STREQUAL "+RELEASE" )
  696. # found directive "SOURCES"
  697. if( "+${_arg}" STREQUAL "+SOURCES" )
  698. set( _skip_store 1 )
  699. set( _storage "_sources" )
  700. endif( "+${_arg}" STREQUAL "+SOURCES" )
  701. # found directive "EMBED"
  702. if( "+${_arg}" STREQUAL "+EMBED" )
  703. set( _skip_store 1 )
  704. set( _storage "_embed" )
  705. endif( "+${_arg}" STREQUAL "+EMBED" )
  706. # found directive "LINK"
  707. if( "+${_arg}" STREQUAL "+LINK" )
  708. set( _skip_store 1 )
  709. set( _storage "_link" )
  710. endif( "+${_arg}" STREQUAL "+LINK" )
  711. # found directive "LINK_PRIVATE"
  712. if( "+${_arg}" STREQUAL "+LINK_PRIVATE" )
  713. set( _skip_store 1 )
  714. set( _storage "_link_private" )
  715. endif( "+${_arg}" STREQUAL "+LINK_PRIVATE" )
  716. # found directive "DEPENDENCIES"
  717. if( "+${_arg}" STREQUAL "+DEPENDENCIES" )
  718. set( _skip_store 1 )
  719. set( _storage "_dependencies" )
  720. endif( "+${_arg}" STREQUAL "+DEPENDENCIES" )
  721. # found directive "DESTINATION"
  722. if( "+${_arg}" STREQUAL "+DESTINATION" )
  723. set( _skip_store 1 )
  724. set( _storage "_destination" )
  725. unset( ${_storage} )
  726. endif( "+${_arg}" STREQUAL "+DESTINATION" )
  727. # found directive "EXCLUDE_FROM_ALL"
  728. if( "+${_arg}" STREQUAL "+EXCLUDE_FROM_ALL" )
  729. set( _skip_store 1 )
  730. set( _exclude_from_all "EXCLUDE_FROM_ALL" )
  731. endif( "+${_arg}" STREQUAL "+EXCLUDE_FROM_ALL" )
  732. # metadata
  733. if( "+${_arg}" STREQUAL "+DESCRIPTION" )
  734. set( _skip_store 1 )
  735. set( _storage "_description" )
  736. endif( )
  737. if( "+${_arg}" STREQUAL "+LICENSE" )
  738. set( _skip_store 1 )
  739. set( _storage "_license" )
  740. endif( )
  741. if( "+${_arg}" STREQUAL "+COPYRIGHT" )
  742. set( _skip_store 1 )
  743. set( _storage "_copyright" )
  744. endif( )
  745. if( "+${_arg}" STREQUAL "+AUTHORS" )
  746. set( _skip_store 1 )
  747. set( _storage "_authors" )
  748. endif( )
  749. if( "+${_arg}" STREQUAL "+PRODUCT" )
  750. set( _skip_store 1 )
  751. set( _storage "_product" )
  752. endif( )
  753. if( "+${_arg}" STREQUAL "+ORGANIZATION" )
  754. set( _skip_store 1 )
  755. set( _storage "_organization" )
  756. endif( )
  757. if( "+${_arg}" STREQUAL "+VERSION" )
  758. set( _skip_store 1 )
  759. set( _storage "_version" )
  760. endif( )
  761. if( "+${_arg}" STREQUAL "+DATETIME" )
  762. set( _skip_store 1 )
  763. set( _storage "_datetime" )
  764. endif( )
  765. if( "+${_arg}" STREQUAL "+NOTES" )
  766. set( _skip_store 1 )
  767. set( _storage "_notes" )
  768. endif( )
  769. # storing value
  770. if( _storage AND NOT _skip_store )
  771. list( APPEND ${_storage} ${_arg} )
  772. list( REMOVE_DUPLICATES ${_storage} )
  773. endif( _storage AND NOT _skip_store )
  774. endforeach( _arg )
  775. # if no type is set, we choose one
  776. # based on BUILD_SHARED_LIBS
  777. if( NOT _type )
  778. if( BUILD_SHARED_LIBS )
  779. set( _type "SHARED" )
  780. else( BUILD_SHARED_LIBS )
  781. set( _type "STATIC" )
  782. endif( BUILD_SHARED_LIBS )
  783. endif( NOT _type )
  784. # change target name, based on type
  785. string( TOLOWER "${_type}" _type_lower )
  786. set( _target "${_arg_target}-${_type_lower}" )
  787. # create variables like "LIB_xxx" for convenience
  788. if( ${_type} STREQUAL "SHARED" )
  789. string( TOUPPER "${_arg_target}" _tmp )
  790. set( LIB_${_tmp} ${_target} CACHE INTERNAL LIB_${tmp} FORCE )
  791. endif( ${_type} STREQUAL "SHARED" )
  792. # disallow target without sources
  793. if( NOT _sources )
  794. message( FATAL_ERROR "\nTarget [$_target] have no sources." )
  795. endif( NOT _sources )
  796. # processing different types of sources
  797. __tde_internal_process_sources( _sources ${_sources} )
  798. # set automoc
  799. if( _automoc )
  800. tde_automoc( ${_sources} )
  801. endif( _automoc )
  802. # add target
  803. add_library( ${_target} ${_type} ${_exclude_from_all} ${_sources} )
  804. # we assume that modules have no prefix and no version
  805. # also, should not link
  806. if( ${_type} STREQUAL "MODULE" )
  807. set_target_properties( ${_target} PROPERTIES PREFIX "" )
  808. unset( _version )
  809. set( _shouldnotlink yes )
  810. endif( ${_type} STREQUAL "MODULE" )
  811. # set real name of target
  812. if( _release )
  813. # add release number to output name
  814. set_target_properties( ${_target} PROPERTIES RELEASE ${_release} )
  815. set_target_properties( ${_target} PROPERTIES OUTPUT_NAME "${_arg_target}-${_release}" )
  816. else( _release )
  817. set_target_properties( ${_target} PROPERTIES OUTPUT_NAME ${_arg_target} )
  818. endif( _release )
  819. # set -fPIC flag for static libraries
  820. if( _static_pic )
  821. if( "${CMAKE_VERSION}" VERSION_LESS "2.8.9" )
  822. set_target_properties( ${_target} PROPERTIES COMPILE_FLAGS -fPIC )
  823. else( )
  824. set_target_properties( ${_target} PROPERTIES POSITION_INDEPENDENT_CODE ON )
  825. endif( )
  826. endif( _static_pic )
  827. # set version
  828. if( _version )
  829. if( ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" )
  830. # OpenBSD: _soversion and _version both contains only major and minor
  831. string( REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" _dummy "${_version}" )
  832. set( _version "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" )
  833. set( _soversion "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" )
  834. else( ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" )
  835. # General (Linux) case: _soversion contains only the major number of version
  836. string( REGEX MATCH "^[0-9]+" _soversion ${_version} )
  837. endif( ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" )
  838. set_target_properties( ${_target} PROPERTIES VERSION ${_version} SOVERSION ${_soversion} )
  839. endif( _version )
  840. # set interface libraries (only for shared)
  841. unset( _shared_libs )
  842. if( NOT ${_type} STREQUAL "STATIC" )
  843. foreach( _lib ${_link} )
  844. #get_target_property( _lib_type ${_lib} TYPE )
  845. #if( NOT "STATIC_LIBRARY" STREQUAL "${_lib_type}" )
  846. if( NOT ${_lib} MATCHES ".+-static" )
  847. list( APPEND _shared_libs ${_lib} )
  848. endif( NOT ${_lib} MATCHES ".+-static" )
  849. #endif( NOT "STATIC_LIBRARY" STREQUAL "${_lib_type}" )
  850. endforeach( _lib )
  851. endif( NOT ${_type} STREQUAL "STATIC" )
  852. # set embedded archives
  853. if( _embed )
  854. if( ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" )
  855. list( INSERT _link 0 -Wl,-zallextract ${_embed} -Wl,-zdefaultextract )
  856. else( )
  857. list( INSERT _link 0 -Wl,-whole-archive ${_embed} -Wl,-no-whole-archive )
  858. endif( )
  859. endif( _embed )
  860. # set private linked libraries
  861. if( _link_private )
  862. if( NOT ${CMAKE_VERSION} VERSION_LESS "2.8.12" )
  863. if( _link )
  864. list( INSERT _link 0 "PUBLIC" )
  865. endif()
  866. list( APPEND _link "PRIVATE" )
  867. endif()
  868. list( APPEND _link ${_link_private} )
  869. endif( _link_private )
  870. # set link libraries
  871. if( _link )
  872. if( _embed AND ${CMAKE_VERSION} VERSION_EQUAL "2.8.12.0" )
  873. # hack for broken CMake 2.8.12.0
  874. set_target_properties( ${_target} PROPERTIES LINK_LIBRARIES "${_link}" )
  875. else( _embed AND ${CMAKE_VERSION} VERSION_EQUAL "2.8.12.0" )
  876. target_link_libraries( ${_target} ${_link} )
  877. endif( _embed AND ${CMAKE_VERSION} VERSION_EQUAL "2.8.12.0" )
  878. endif( )
  879. if( _shared_libs )
  880. string( TOUPPER "${CMAKE_BUILD_TYPE}" _build_type )
  881. set_target_properties( ${_target} PROPERTIES
  882. LINK_INTERFACE_LIBRARIES "${_shared_libs}"
  883. LINK_INTERFACE_LIBRARIES_${_build_type} "${_shared_libs}"
  884. INTERFACE_LINK_LIBRARIES "${_shared_libs}"
  885. INTERFACE_LINK_LIBRARIES_${_build_type} "${_shared_libs}" )
  886. endif( _shared_libs )
  887. # set dependencies
  888. if( _dependencies )
  889. add_dependencies( ${_target} ${_dependencies} )
  890. endif( _dependencies )
  891. # if destination directory is set
  892. if( _destination )
  893. # we export only shared libs (no static, no modules);
  894. # also, do not export targets marked as "NO_EXPORT" (usually for tdeinit)
  895. if( "SHARED" STREQUAL ${_type} AND NOT _no_export )
  896. # get target properties: output name, version, soversion
  897. tde_get_library_filename( _output ${_target} )
  898. get_target_property( _version ${_target} VERSION )
  899. get_target_property( _soversion ${_target} SOVERSION )
  900. if( _version )
  901. set( _location "${_destination}/${_output}.${_version}" )
  902. set( _soname "${_output}.${_soversion}" )
  903. else( )
  904. set( _location "${_destination}/${_output}" )
  905. set( _soname "${_output}" )
  906. unset( _version )
  907. endif( )
  908. configure_file( ${TDE_CMAKE_TEMPLATES}/tde_export_library.cmake "${PROJECT_BINARY_DIR}/export-${_target}.cmake" @ONLY )
  909. endif( )
  910. # install target
  911. install( TARGETS ${_target} DESTINATION ${_destination} )
  912. # install base soname
  913. if( _release AND NOT "STATIC" STREQUAL ${_type} )
  914. tde_get_library_filename( _soname ${_target} )
  915. string( REPLACE "-${_release}" "" _soname_base "${_soname}" )
  916. if( _version )
  917. get_target_property( _soversion ${_target} SOVERSION )
  918. set( _soname "${_soname}.${_soversion}" )
  919. endif( )
  920. if( NOT _exclude_from_all )
  921. add_custom_command(
  922. OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_soname_base}"
  923. COMMAND ln -s ${_soname} "${CMAKE_CURRENT_BINARY_DIR}/${_soname_base}"
  924. DEPENDS ${_target}
  925. )
  926. add_custom_target(
  927. ${_target}+base-so ALL
  928. DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_soname_base}"
  929. )
  930. else( )
  931. add_custom_command(
  932. TARGET ${_target} POST_BUILD
  933. COMMAND ln -s ${_soname} "${CMAKE_CURRENT_BINARY_DIR}/${_soname_base}"
  934. )
  935. endif( )
  936. install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${_soname_base}" DESTINATION ${_destination} )
  937. endif( )
  938. # install .la files for dynamic libraries
  939. if( NOT "STATIC" STREQUAL ${_type} AND NOT _no_libtool_file )
  940. tde_install_libtool_file( ${_target} ${_destination} )
  941. endif( )
  942. endif( _destination )
  943. # embed name and metadata
  944. set( ELF_EMBEDDING_METADATA "\"${_target}\" \"${_description}\" \"${_license}\" \"${_copyright}\" \"${_authors}\" \"${_product}\" \"${_organization}\" \"${_version}\" \"${_datetime}\" \"x-sharedlib\" \"${TDE_SCM_MODULE_NAME}\" \"${TDE_SCM_MODULE_REVISION}\" \"${_notes}\"" )
  945. separate_arguments( ELF_EMBEDDING_METADATA )
  946. if( TDELFEDITOR_EXECUTABLE AND _soname )
  947. if( _version )
  948. get_filename_component( _target_lib ${CMAKE_CURRENT_BINARY_DIR}/${_soname}.${_version} ABSOLUTE )
  949. else( )
  950. get_filename_component( _target_lib ${CMAKE_CURRENT_BINARY_DIR}/${_soname} ABSOLUTE )
  951. endif( )
  952. file( RELATIVE_PATH _target_path "${CMAKE_BINARY_DIR}" "${_target_lib}" )
  953. if( TARGET ${TDELFEDITOR_EXECUTABLE} AND NOT _exclude_from_all )
  954. # create target for all metadata writes
  955. if( NOT TARGET tdelfeditor-write )
  956. add_custom_target( tdelfeditor-write
  957. WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
  958. DEPENDS ${TDELFEDITOR_EXECUTABLE}
  959. COMMENT "Write metadata to binaries..."
  960. )
  961. endif( )
  962. add_custom_target(
  963. ${_target}+metadata ALL
  964. COMMAND ${TDELFEDITOR_EXECUTABLE} -m ${_target_lib} ${ELF_EMBEDDING_METADATA} || true
  965. COMMAND ${TDELFEDITOR_EXECUTABLE} -e ${_target_lib} || true
  966. COMMENT "Storing SCM metadata in ${_target_path}"
  967. DEPENDS tdelfeditor-write
  968. )
  969. add_dependencies( tdelfeditor-write ${_target} )
  970. else( )
  971. add_custom_command(
  972. TARGET ${_target}
  973. POST_BUILD
  974. COMMAND ${TDELFEDITOR_EXECUTABLE} -m ${_target_lib} ${ELF_EMBEDDING_METADATA} || true
  975. COMMAND ${TDELFEDITOR_EXECUTABLE} -e ${_target_lib} || true
  976. COMMENT "Storing SCM metadata in ${_target_path}"
  977. )
  978. if( TARGET ${TDELFEDITOR_EXECUTABLE} )
  979. add_dependencies( ${_target} ${TDELFEDITOR_EXECUTABLE} )
  980. endif()
  981. endif( )
  982. endif( TDELFEDITOR_EXECUTABLE AND _soname )
  983. endmacro( tde_add_library )
  984. #################################################
  985. #####
  986. ##### tde_add_kpart
  987. macro( tde_add_kpart _target )
  988. tde_add_library( ${_target} ${ARGN} MODULE )
  989. endmacro( tde_add_kpart )
  990. #################################################
  991. #####
  992. ##### tde_curdatetime
  993. macro( tde_curdatetime result )
  994. if( TDE_PKG_DATETIME )
  995. set( ${result} ${TDE_PKG_DATETIME} )
  996. elseif( TDE_SCM_MODULE_DATETIME )
  997. set( ${result} ${TDE_SCM_MODULE_DATETIME} )
  998. else( )
  999. tde_execute_process( COMMAND "date" "+%m/%d/%Y %H:%M:%S" OUTPUT_VARIABLE ${result} )
  1000. string( REGEX REPLACE "(..)/(..)/(....) (........).*" "\\1/\\2/\\3 \\4" ${result} ${${result}} )
  1001. endif( )
  1002. endmacro( tde_curdatetime )
  1003. #################################################
  1004. #####
  1005. ##### tde_add_executable
  1006. macro( tde_add_executable _arg_target )
  1007. unset( _target )
  1008. unset( _automoc )
  1009. unset( _meta_includes )
  1010. unset( _setuid )
  1011. unset( _sources )
  1012. unset( _destination )
  1013. unset( _link )
  1014. unset( _dependencies )
  1015. unset( _storage )
  1016. # metadata
  1017. unset( _description )
  1018. unset( _license )
  1019. unset( _copyright )
  1020. unset( _authors )
  1021. unset( _product )
  1022. unset( _organization )
  1023. unset( _version )
  1024. unset( _datetime )
  1025. unset( _notes )
  1026. # default metadata
  1027. set( _product "Trinity Desktop Environment" )
  1028. set( _version "${TDE_VERSION}" )
  1029. if( TDE_PKG_VERSION )
  1030. set( _version "${_version} (${TDE_PKG_VERSION})" )
  1031. endif( )
  1032. tde_curdatetime( _datetime )
  1033. foreach( _arg ${ARGV} )
  1034. # this variable help us to skip
  1035. # storing unapropriate values (i.e. directives)
  1036. unset( _skip_store )
  1037. # found directive "AUTOMOC"
  1038. if( "+${_arg}" STREQUAL "+AUTOMOC" )
  1039. set( _skip_store 1 )
  1040. set( _automoc 1 )
  1041. endif( "+${_arg}" STREQUAL "+AUTOMOC" )
  1042. # found directive "META_INCLUDES"
  1043. if( "+${_arg}" STREQUAL "+META_INCLUDES" )
  1044. set( _skip_store 1 )
  1045. set( _storage "_meta_includes" )
  1046. endif( )
  1047. # found directive "SETUID"
  1048. if( "+${_arg}" STREQUAL "+SETUID" )
  1049. set( _skip_store 1 )
  1050. set( _setuid 1 )
  1051. endif( "+${_arg}" STREQUAL "+SETUID" )
  1052. # found directive "SOURCES"
  1053. if( "+${_arg}" STREQUAL "+SOURCES" )
  1054. set( _skip_store 1 )
  1055. set( _storage "_sources" )
  1056. endif( "+${_arg}" STREQUAL "+SOURCES" )
  1057. # found directive "LINK"
  1058. if( "+${_arg}" STREQUAL "+LINK" )
  1059. set( _skip_store 1 )
  1060. set( _storage "_link" )
  1061. endif( "+${_arg}" STREQUAL "+LINK" )
  1062. # found directive "DEPENDENCIES"
  1063. if( "+${_arg}" STREQUAL "+DEPENDENCIES" )
  1064. set( _skip_store 1 )
  1065. set( _storage "_dependencies" )
  1066. endif( "+${_arg}" STREQUAL "+DEPENDENCIES" )
  1067. # found directive "DESTINATION"
  1068. if( "+${_arg}" STREQUAL "+DESTINATION" )
  1069. set( _skip_store 1 )
  1070. set( _storage "_destination" )
  1071. unset( ${_storage} )
  1072. endif( "+${_arg}" STREQUAL "+DESTINATION" )
  1073. # metadata
  1074. if( "+${_arg}" STREQUAL "+DESCRIPTION" )
  1075. set( _skip_store 1 )
  1076. set( _storage "_description" )
  1077. endif( )
  1078. if( "+${_arg}" STREQUAL "+LICENSE" )
  1079. set( _skip_store 1 )
  1080. set( _storage "_license" )
  1081. endif( )
  1082. if( "+${_arg}" STREQUAL "+COPYRIGHT" )
  1083. set( _skip_store 1 )
  1084. set( _storage "_copyright" )
  1085. endif( )
  1086. if( "+${_arg}" STREQUAL "+AUTHORS" )
  1087. set( _skip_store 1 )
  1088. set( _storage "_authors" )
  1089. endif( )
  1090. if( "+${_arg}" STREQUAL "+PRODUCT" )
  1091. set( _skip_store 1 )
  1092. set( _storage "_product" )
  1093. endif( )
  1094. if( "+${_arg}" STREQUAL "+ORGANIZATION" )
  1095. set( _skip_store 1 )
  1096. set( _storage "_organization" )
  1097. endif( )
  1098. if( "+${_arg}" STREQUAL "+VERSION" )
  1099. set( _skip_store 1 )
  1100. set( _storage "_version" )
  1101. endif( )
  1102. if( "+${_arg}" STREQUAL "+DATETIME" )
  1103. set( _skip_store 1 )
  1104. set( _storage "_datetime" )
  1105. endif( )
  1106. if( "+${_arg}" STREQUAL "+NOTES" )
  1107. set( _skip_store 1 )
  1108. set( _storage "_notes" )
  1109. endif( )
  1110. # storing value
  1111. if( _storage AND NOT _skip_store )
  1112. #set( ${_storage} "${${_storage}} ${_arg}" )
  1113. list( APPEND ${_storage} ${_arg} )
  1114. endif( _storage AND NOT _skip_store )
  1115. endforeach( _arg )
  1116. set( _target "${_arg_target}" )
  1117. # disallow target without sources
  1118. if( NOT _sources )
  1119. message( FATAL_ERROR "\nTarget [$_target] have no sources." )
  1120. endif( NOT _sources )
  1121. # processing different types of sources
  1122. __tde_internal_process_sources( _sources ${_sources} )
  1123. # set automoc
  1124. if( _automoc )
  1125. tde_automoc( ${_sources} )
  1126. endif( _automoc )
  1127. # add target
  1128. add_executable( ${_target} ${_sources} )
  1129. # set link libraries
  1130. if( _link )
  1131. target_link_libraries( ${_target} ${_link} )
  1132. endif( _link )
  1133. # set dependencies
  1134. if( _dependencies )
  1135. add_dependencies( ${_target} ${_dependencies} )
  1136. endif( _dependencies )
  1137. # set PIE flags for setuid binaries
  1138. if( _setuid )
  1139. set_target_properties( ${_target} PROPERTIES COMPILE_FLAGS "${TDE_PIE_CFLAGS}" )
  1140. set_target_properties( ${_target} PROPERTIES LINK_FLAGS "${TDE_PIE_LDFLAGS}" )
  1141. endif( _setuid )
  1142. # set destination directory
  1143. if( _destination )
  1144. if( _setuid )
  1145. install( TARGETS ${_target} DESTINATION ${_destination} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE SETUID )
  1146. else( _setuid )
  1147. install( TARGETS ${_target} DESTINATION ${_destination} )
  1148. endif( _setuid )
  1149. endif( _destination )
  1150. # embed icon, name, and metadata
  1151. set( ELF_EMBEDDING_METADATA "\"${_target}\" \"${_description}\" \"${_license}\" \"${_copyright}\" \"${_authors}\" \"${_product}\" \"${_organization}\" \"${_version}\" \"${_datetime}\" \"${_target}\" \"${TDE_SCM_MODULE_NAME}\" \"${TDE_SCM_MODULE_REVISION}\" \"${_notes}\"" )
  1152. separate_arguments( ELF_EMBEDDING_METADATA )
  1153. if( TDELFEDITOR_EXECUTABLE )
  1154. get_filename_component( _target_path ${CMAKE_CURRENT_BINARY_DIR}/${_target} ABSOLUTE )
  1155. file( RELATIVE_PATH _target_path "${CMAKE_BINARY_DIR}" "${_target_path}" )
  1156. if( TARGET ${TDELFEDITOR_EXECUTABLE} )
  1157. # create target for all metadata writes
  1158. if( NOT TARGET tdelfeditor-write )
  1159. add_custom_target( tdelfeditor-write
  1160. WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
  1161. DEPENDS ${TDELFEDITOR_EXECUTABLE}
  1162. COMMENT "Write metadata to binaries..."
  1163. )
  1164. endif( )
  1165. add_custom_target(
  1166. ${_target}+metadata ALL
  1167. COMMAND ${TDELFEDITOR_EXECUTABLE} -m ${CMAKE_CURRENT_BINARY_DIR}/${_target} ${ELF_EMBEDDING_METADATA} || true
  1168. COMMAND ${TDELFEDITOR_EXECUTABLE} -e ${CMAKE_CURRENT_BINARY_DIR}/${_target} || true
  1169. COMMENT "Storing SCM metadata in ${_target_path}"
  1170. DEPENDS tdelfeditor-write
  1171. )
  1172. add_dependencies( tdelfeditor-write ${_target} )
  1173. else()
  1174. add_custom_command(
  1175. TARGET ${_target}
  1176. POST_BUILD
  1177. COMMAND ${TDELFEDITOR_EXECUTABLE} -m ${CMAKE_CURRENT_BINARY_DIR}/${_target} ${ELF_EMBEDDING_METADATA} || true
  1178. COMMAND ${TDELFEDITOR_EXECUTABLE} -e ${CMAKE_CURRENT_BINARY_DIR}/${_target} || true
  1179. COMMAND ${TDELFEDITOR_EXECUTABLE} -t ${CMAKE_CURRENT_BINARY_DIR}/${_target} ${_target} || true
  1180. COMMENT "Storing SCM metadata in ${_target_path}"
  1181. )
  1182. endif()
  1183. endif( TDELFEDITOR_EXECUTABLE )
  1184. endmacro( tde_add_executable )
  1185. #################################################
  1186. #####
  1187. ##### tde_add_check_executable
  1188. macro( tde_add_check_executable _arg_target )
  1189. unset( _target )
  1190. unset( _automoc )
  1191. unset( _test )
  1192. unset( _test_args )
  1193. unset( _meta_includes )
  1194. unset( _sources )
  1195. unset( _destination )
  1196. unset( _link )
  1197. unset( _dependencies )
  1198. unset( _storage )
  1199. foreach( _arg ${ARGV} )
  1200. # this variable help us to skip
  1201. # storing unapropriate values (i.e. directives)
  1202. unset( _skip_store )
  1203. # found directive "AUTOMOC"
  1204. if( "+${_arg}" STREQUAL "+AUTOMOC" )
  1205. set( _skip_store 1 )
  1206. set( _automoc 1 )
  1207. endif( "+${_arg}" STREQUAL "+AUTOMOC" )
  1208. # found directive "TEST"
  1209. if( "+${_arg}" STREQUAL "+TEST" )
  1210. set( _skip_store 1 )
  1211. set( _test 1 )
  1212. set( _storage "_test_args" )
  1213. endif( "+${_arg}" STREQUAL "+TEST" )
  1214. # found directive "META_INCLUDES"
  1215. if( "+${_arg}" STREQUAL "+META_INCLUDES" )
  1216. set( _skip_store 1 )
  1217. set( _storage "_meta_includes" )
  1218. endif( )
  1219. # found directive "SOURCES"
  1220. if( "+${_arg}" STREQUAL "+SOURCES" )
  1221. set( _skip_store 1 )
  1222. set( _storage "_sources" )
  1223. endif( "+${_arg}" STREQUAL "+SOURCES" )
  1224. # found directive "LINK"
  1225. if( "+${_arg}" STREQUAL "+LINK" )
  1226. set( _skip_store 1 )
  1227. set( _storage "_link" )
  1228. endif( "+${_arg}" STREQUAL "+LINK" )
  1229. # found directive "DEPENDENCIES"
  1230. if( "+${_arg}" STREQUAL "+DEPENDENCIES" )
  1231. set( _skip_store 1 )
  1232. set( _storage "_dependencies" )
  1233. endif( "+${_arg}" STREQUAL "+DEPENDENCIES" )
  1234. # storing value
  1235. if( _storage AND NOT _skip_store )
  1236. #set( ${_storage} "${${_storage}} ${_arg}" )
  1237. list( APPEND ${_storage} ${_arg} )
  1238. endif( _storage AND NOT _skip_store )
  1239. endforeach( _arg )
  1240. set( _target "${_arg_target}" )
  1241. # try to autodetect sources
  1242. if( NOT _sources )
  1243. file( GLOB _sources "${_target}.cpp" "${_target}.cxx" "${_target}.c" )
  1244. if( NOT _sources )
  1245. message( FATAL_ERROR "\nNo sources found for test executable \"${_target}\"." )
  1246. endif( )
  1247. endif( NOT _sources )
  1248. # processing different types of sources
  1249. __tde_internal_process_sources( _sources ${_sources} )
  1250. # set automoc
  1251. if( _automoc )
  1252. tde_automoc( ${_sources} )
  1253. endif( _automoc )
  1254. # add target
  1255. add_executable( ${_target} EXCLUDE_FROM_ALL ${_sources} )
  1256. # set link libraries
  1257. if( _link )
  1258. target_link_libraries( ${_target} ${_link} )
  1259. endif( _link )
  1260. # set dependencies
  1261. if( _dependencies )
  1262. add_dependencies( ${_target} ${_dependencies} )
  1263. endif( _dependencies )
  1264. # create make check target
  1265. if(NOT TARGET check)
  1266. add_custom_target( check
  1267. COMMAND ${CMAKE_CTEST_COMMAND}
  1268. WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
  1269. COMMENT "Running tests..." )
  1270. endif(NOT TARGET check)
  1271. add_dependencies( check ${_target} )
  1272. # add test target
  1273. if( _test )
  1274. # get relative path to current directory and strip end tests dir
  1275. file( RELATIVE_PATH _test_prefix ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} )
  1276. string( REGEX REPLACE "(^\\.+/?|(^|/)tests?$|/$)" "" _test_prefix "${_test_prefix}" )
  1277. if( _test_prefix )
  1278. set( _test_prefix "${_test_prefix}/" )
  1279. endif( _test_prefix )
  1280. add_test( NAME "${_test_prefix}${_target}" COMMAND "${_target}" ${_test_args} )
  1281. endif( _test )
  1282. endmacro( tde_add_check_executable )
  1283. #################################################
  1284. #####
  1285. ##### tde_add_tdeinit_executable
  1286. macro( tde_add_tdeinit_executable _target )
  1287. configure_file( ${TDE_CMAKE_TEMPLATES}/tde_tdeinit_executable.cmake ${_target}_tdeinit_executable.cpp COPYONLY )
  1288. configure_file( ${TDE_CMAKE_TEMPLATES}/tde_tdeinit_module.cmake ${_target}_tdeinit_module.cpp COPYONLY )
  1289. unset( _sources )
  1290. unset( _runtime_destination )
  1291. unset( _library_destination )
  1292. unset( _plugin_destination )
  1293. # default storage is _sources
  1294. set( _storage _sources )
  1295. # set default export to NO_EXPORT
  1296. set( _export "NO_EXPORT" )
  1297. foreach( _arg ${ARGN} )
  1298. # this variable help us to skip
  1299. # storing unapropriate values (i.e. directives)
  1300. unset( _skip_store )
  1301. # found directive "EXPORT"
  1302. if( "+${_arg}" STREQUAL "+EXPORT" )
  1303. set( _skip_store 1 )
  1304. unset( _export )
  1305. endif( "+${_arg}" STREQUAL "+EXPORT" )
  1306. # found directive "RUNTIME_DESTINATION"
  1307. if( "+${_arg}" STREQUAL "+RUNTIME_DESTINATION" )
  1308. set( _skip_store 1 )
  1309. set( _storage "_runtime_destination" )
  1310. unset( ${_storage} )
  1311. endif( "+${_arg}" STREQUAL "+RUNTIME_DESTINATION" )
  1312. # found directive "LIBRARY_DESTINATION"
  1313. if( "+${_arg}" STREQUAL "+LIBRARY_DESTINATION" )
  1314. set( _skip_store 1 )
  1315. set( _storage "_library_destination" )
  1316. unset( ${_storage} )
  1317. endif( "+${_arg}" STREQUAL "+LIBRARY_DESTINATION" )
  1318. # found directive "PLUGIN_DESTINATION"
  1319. if( "+${_arg}" STREQUAL "+PLUGIN_DESTINATION" )
  1320. set( _skip_store 1 )
  1321. set( _storage "_plugin_destination" )
  1322. unset( ${_storage} )
  1323. endif( "+${_arg}" STREQUAL "+PLUGIN_DESTINATION" )
  1324. # storing value
  1325. if( _storage AND NOT _skip_store )
  1326. list( APPEND ${_storage} ${_arg} )
  1327. set( _storage "_sources" )
  1328. endif( _storage AND NOT _skip_store )
  1329. endforeach( _arg )
  1330. # if destinations are not set, we using some defaults
  1331. # we assume that tdeinit executable MUST be installed
  1332. # (otherwise why we build it?)
  1333. if( NOT _runtime_destination )
  1334. set( _runtime_destination ${BIN_INSTALL_DIR} )
  1335. endif( NOT _runtime_destination )
  1336. if( NOT _library_destination )
  1337. set( _library_destination ${LIB_INSTALL_DIR} )
  1338. endif( NOT _library_destination )
  1339. if( NOT _plugin_destination )
  1340. set( _plugin_destination ${PLUGIN_INSTALL_DIR} )
  1341. endif( NOT _plugin_destination )
  1342. # create the library
  1343. tde_add_library( tdeinit_${_target} ${_sources} SHARED ${_export}
  1344. DESTINATION ${_library_destination}
  1345. )
  1346. # create the executable
  1347. tde_add_executable( ${_target}
  1348. SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${_target}_tdeinit_executable.cpp
  1349. LINK tdeinit_${_target}-shared
  1350. DESTINATION ${_runtime_destination}
  1351. )
  1352. # create the plugin
  1353. tde_add_kpart( ${_target}
  1354. SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${_target}_tdeinit_module.cpp
  1355. LINK tdeinit_${_target}-shared
  1356. DESTINATION ${_plugin_destination}
  1357. )
  1358. endmacro( tde_add_tdeinit_executable )
  1359. #################################################
  1360. #####
  1361. ##### tde_create_translation
  1362. macro( tde_create_translation )
  1363. unset( _srcs )
  1364. unset( _lang )
  1365. unset( _dest )
  1366. unset( _out_name )
  1367. unset( _directive )
  1368. unset( _var )
  1369. foreach( _arg ${ARGN} )
  1370. # found directive "FILES"
  1371. if( "+${_arg}" STREQUAL "+FILES" )
  1372. unset( _srcs )
  1373. set( _var _srcs )
  1374. set( _directive 1 )
  1375. endif( )
  1376. # found directive "LANG"
  1377. if( "+${_arg}" STREQUAL "+LANG" )
  1378. unset( _lang )
  1379. set( _var _lang )
  1380. set( _directive 1 )
  1381. endif( )
  1382. # found directive "DESTINATION"
  1383. if( "+${_arg}" STREQUAL "+DESTINATION" )
  1384. unset( _dest )
  1385. set( _var _dest )
  1386. set( _directive 1 )
  1387. endif( )
  1388. # found directive "OUTPUT_NAME"
  1389. if( "+${_arg}" STREQUAL "+OUTPUT_NAME" )
  1390. unset( _out_name )
  1391. set( _var _out_name )
  1392. set( _directive 1 )
  1393. endif( )
  1394. # collect data
  1395. if( _directive )
  1396. unset( _directive )
  1397. elseif( _var )
  1398. list( APPEND ${_var} ${_arg} )
  1399. endif()
  1400. endforeach( )
  1401. if( NOT MSGFMT_EXECUTABLE )
  1402. tde_setup_msgfmt( )
  1403. endif( )
  1404. if( NOT _lang )
  1405. tde_message_fatal( "missing LANG directive" )
  1406. endif( )
  1407. # if no file specified, include all *.po files
  1408. if( NOT _srcs )
  1409. file( GLOB _srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po )
  1410. endif( )
  1411. if( NOT _srcs )
  1412. tde_message_fatal( "no source files" )
  1413. endif( )
  1414. if( NOT _lang STREQUAL "auto")
  1415. set( _real_lang ${_lang} )
  1416. if( NOT _dest )
  1417. set( _dest "${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES" )
  1418. endif( )
  1419. # OUTPUT_NAME can only be used if we have only one file
  1420. list( LENGTH _srcs _srcs_num)
  1421. if( _out_name AND _srcs_num GREATER 1 )
  1422. tde_message_fatal( "OUTPUT_NAME can be supplied only with single file or LANG=auto" )
  1423. endif( )
  1424. elseif( NOT _out_name )
  1425. tde_message_fatal( "LANG=auto reqires OUTPUT_NAME directive to be set" )
  1426. elseif( _dest )
  1427. tde_message_fatal( "DESTINATION cannot be used with LANG=auto" )
  1428. endif( )
  1429. # generate *.mo files
  1430. foreach( _src ${_srcs} )
  1431. get_filename_component( _src ${_src} ABSOLUTE )
  1432. if( _out_name )
  1433. set( _out ${_out_name} )
  1434. if( _lang STREQUAL "auto" )
  1435. get_filename_component( _real_lang ${_src} NAME_WE )
  1436. set( _dest "${LOCALE_INSTALL_DIR}/${_real_lang}/LC_MESSAGES" )
  1437. endif( )
  1438. else( )
  1439. get_filename_component( _out ${_src} NAME_WE )
  1440. endif( )
  1441. string( REPLACE "@" "_" _target ${_real_lang} )
  1442. set( _out_filename "${_out}-${_real_lang}.mo" )
  1443. set( _install_filename "${_out}.mo" )
  1444. add_custom_command(
  1445. OUTPUT ${_out_filename}
  1446. COMMAND ${MSGFMT_EXECUTABLE} ${_src} -o ${_out_filename}
  1447. DEPENDS ${_src} )
  1448. add_custom_target( "${_out}-${_target}-translation" ALL DEPENDS ${_out_filename} )
  1449. install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${_out_filename} RENAME ${_install_filename} DESTINATION ${_dest} )
  1450. endforeach( )
  1451. endmacro( )
  1452. #################################################
  1453. #####
  1454. ##### tde_create_translated_desktop
  1455. #####
  1456. ##### Macro is used to merge translations into desktop file
  1457. #####
  1458. ##### Syntax:
  1459. ##### tde_create_translated_desktop(
  1460. ##### [SOURCE] file_name
  1461. ##### [KEYWORDS keyword [keyword]]
  1462. ##### [PO_DIR po_directory]
  1463. ##### [DESTINATION directory]
  1464. ##### [OUTPUT_NAME file_name]
  1465. ##### )
  1466. macro( tde_create_translated_desktop )
  1467. unset( _srcs )
  1468. unset( _arg_out_name )
  1469. unset( _arg_po_dir )
  1470. unset( _keywords_add )
  1471. unset( _dest )
  1472. unset( _directive )
  1473. set( _var _srcs )
  1474. set( _keywords_desktop_default
  1475. "Name" "GenericName" "Comment" "Keywords"
  1476. "Description" "ExtraNames" "X-TDE-Submenu" )
  1477. foreach( _arg ${ARGN} )
  1478. # found directive "SOURCE"
  1479. if( "+${_arg}" STREQUAL "+SOURCE" )
  1480. unset( _srcs )
  1481. set( _var _srcs )
  1482. set( _directive 1 )
  1483. endif( )
  1484. # found directive "KEYWORDS"
  1485. if( "+${_arg}" STREQUAL "+KEYWORDS" )
  1486. unset( _keywords_add )
  1487. set( _var _keywords_add )
  1488. set( _directive 1 )
  1489. endif( )
  1490. # found directive "PO_DIR"
  1491. if( "+${_arg}" STREQUAL "+PO_DIR" )
  1492. unset( _arg_po_dir )
  1493. set( _var _arg_po_dir )
  1494. set( _directive 1 )
  1495. endif( )
  1496. # found directive "DESTINATION"
  1497. if( "+${_arg}" STREQUAL "+DESTINATION" )
  1498. unset( _dest )
  1499. set( _var _dest )
  1500. set( _directive 1 )
  1501. endif( )
  1502. # found directive "OUTPUT_NAME"
  1503. if( "+${_arg}" STREQUAL "+OUTPUT_NAME" )
  1504. unset( _arg_out_name )
  1505. set( _var _arg_out_name )
  1506. set( _directive 1 )
  1507. endif( )
  1508. # collect data
  1509. if( _directive )
  1510. unset( _directive )
  1511. elseif( _var )
  1512. list( APPEND ${_var} ${_arg} )
  1513. endif()
  1514. endforeach( )
  1515. # no source file specified!
  1516. if( NOT _srcs )
  1517. tde_message_fatal( "no source desktop file specified" )
  1518. endif( )
  1519. # OUTPUT_NAME can only be used if we have only one file
  1520. list( LENGTH _srcs _srcs_num )
  1521. if( _arg_out_name AND _srcs_num GREATER 1 )
  1522. tde_message_fatal( "OUTPUT_NAME can be supplied only with single file" )
  1523. endif( )
  1524. # if no destination directory specified, install as application link
  1525. if( NOT _dest )
  1526. set( _dest ${XDG_APPS_INSTALL_DIR} )
  1527. endif( )
  1528. # select a tool for merging desktop file translations
  1529. #
  1530. # Because some of our desktop files contain underscores in variable
  1531. # names (for example eventsrc), which is not an allowed character
  1532. # for names of entries in desktop style files, we can't use msgfmt,
  1533. # so we need intltool-merge.
  1534. #
  1535. #if( NOT MSGFMT_EXECUTABLE OR NOT MSGFMT_VERSION )
  1536. # tde_setup_msgfmt( )
  1537. #endif( )
  1538. #if( "${MSGFMT_VERSION}" VERSION_LESS "0.19" )
  1539. if( TRUE )
  1540. if( NOT INTLTOOL_MERGE_EXECUTABLE )
  1541. find_program( INTLTOOL_MERGE_EXECUTABLE
  1542. NAMES intltool-merge
  1543. HINTS "${TDE_PREFIX}/bin"
  1544. )
  1545. if( "${INTLTOOL_MERGE_EXECUTABLE}" STREQUAL "INTLTOOL_MERGE_EXECUTABLE-NOTFOUND" )
  1546. #tde_message_fatal( "xgettext >= 0.19 or intltool-merge is required but not found" )
  1547. tde_message_fatal( "intltool-merge is required but not found" )
  1548. endif( )
  1549. message( STATUS "Found intltool: ${INTLTOOL_MERGE_EXECUTABLE}" )
  1550. endif( )
  1551. set( DESKTOP_MERGE_INTLTOOL 1 )
  1552. else( )
  1553. set( DESKTOP_MERGE_MSGFMT 1 )
  1554. endif( )
  1555. # pick keywords
  1556. unset( _keywords_desktop )
  1557. foreach( _keyword ${_keywords_desktop_default} ${_keywords_add} )
  1558. if( "${_keyword}" STREQUAL "-" )
  1559. unset( _keywords_desktop )
  1560. unset( _keyword )
  1561. endif( )
  1562. if( _keyword )
  1563. list( APPEND _keywords_desktop "${_keyword}" )
  1564. endif( )
  1565. endforeach( )
  1566. # process source files
  1567. foreach( _src IN LISTS _srcs )
  1568. # get a base name and a directory
  1569. get_filename_component( _basename ${_src} ABSOLUTE )
  1570. get_filename_component( _basedir ${_basename} PATH )
  1571. file( RELATIVE_PATH _basename "${CMAKE_CURRENT_SOURCE_DIR}" "${_basename}" )
  1572. # prepare the binary directory according to source directory
  1573. file( RELATIVE_PATH _binary_basedir "${CMAKE_CURRENT_SOURCE_DIR}" "${_basedir}" )
  1574. set( _binary_basedir "${CMAKE_CURRENT_BINARY_DIR}/${_binary_basedir}" )
  1575. file( MAKE_DIRECTORY "${_binary_basedir}" )
  1576. # process source file as a configuration file if necessary
  1577. if( "+${_src}" MATCHES "\\.cmake$" )
  1578. configure_file( ${_src} ${_basename} @ONLY )
  1579. set( _src "${CMAKE_CURRENT_BINARY_DIR}/${_basename}" )
  1580. string( REGEX REPLACE "\\.cmake$" "" _basename "${_basename}" )
  1581. endif()
  1582. # determine output name
  1583. if( _arg_out_name )
  1584. set( _out_name ${_arg_out_name} )
  1585. else()
  1586. get_filename_component( _out_name ${_basename} NAME )
  1587. endif( )
  1588. # determine po directory
  1589. if( _arg_po_dir )
  1590. set( _po_base ${_arg_po_dir} )
  1591. else()
  1592. get_filename_component( _po_base ${_basename} NAME )
  1593. endif()
  1594. if( IS_ABSOLUTE ${_po_base} )
  1595. set( _po_dir ${_po_base} )
  1596. else()
  1597. if( EXISTS ${CMAKE_SOURCE_DIR}/translations/desktop_files/${_po_base} AND
  1598. IS_DIRECTORY ${CMAKE_SOURCE_DIR}/translations/desktop_files/${_po_base} )
  1599. set( _po_dir ${CMAKE_SOURCE_DIR}/translations/desktop_files/${_po_base} )
  1600. elseif( EXISTS ${CMAKE_SOURCE_DIR}/po/desktop_files/${_po_base} AND
  1601. IS_DIRECTORY ${CMAKE_SOURCE_DIR}/po/desktop_files/${_po_base} )
  1602. set( _po_dir ${CMAKE_SOURCE_DIR}/po/desktop_files/${_po_base} )
  1603. else()
  1604. set( _po_dir ${CMAKE_SOURCE_DIR}/translations/desktop_files )
  1605. endif( )
  1606. endif( )
  1607. # if the translated desktop file is not installed, generate to the specified output name
  1608. if( "${_dest}" STREQUAL "-" )
  1609. set( _basename "${_out_name}" )
  1610. get_filename_component( _out_dir "${CMAKE_CURRENT_BINARY_DIR}/${_out_name}" PATH )
  1611. file( MAKE_DIRECTORY "${_out_dir}" )
  1612. endif( )
  1613. # are there any translations available?
  1614. unset( _translations )
  1615. if( EXISTS "${_po_dir}" AND IS_DIRECTORY "${_po_dir}" )
  1616. file( GLOB _translations RELATIVE "${_po_dir}" "${_po_dir}/*.po" )
  1617. endif( )
  1618. if( _translations )
  1619. # prepare a full name for the target
  1620. get_filename_component( _target ${_basename} ABSOLUTE )
  1621. file( RELATIVE_PATH _target "${CMAKE_SOURCE_DIR}" "${_target}" )
  1622. string( REPLACE "/" "+" _target "${_target}-translated" )
  1623. if( NOT TARGET ${_target} )
  1624. if( DESKTOP_MERGE_MSGFMT )
  1625. # Decide which translations to build; the ones selected in the
  1626. # LINGUAS environment variable, or all that are available.
  1627. if( DEFINED ENV{LINGUAS} )
  1628. set( _linguas "$ENV{LINGUAS}" )
  1629. else( )
  1630. string( REPLACE ".po;" " " _linguas "${_translations};" )
  1631. endif( )
  1632. # prepare keywords for msgfmt
  1633. set( _keywords_arg "--keyword=" )
  1634. foreach( _keyword ${_keywords_desktop} )
  1635. list( APPEND _keywords_arg "--keyword=\"${_keyword}\"" )
  1636. endforeach( )
  1637. # merge translations command
  1638. get_filename_component( _src ${_src} ABSOLUTE )
  1639. add_custom_command(
  1640. OUTPUT ${_basename}
  1641. COMMAND ${CMAKE_COMMAND} -E env "LINGUAS=${_linguas}" ${MSGFMT_EXECUTABLE} --desktop --template ${_src} -d ${_po_dir} -o ${_basename} ${_keywords_arg}
  1642. DEPENDS ${_src}
  1643. )
  1644. else( )
  1645. # create template for intltool-merge
  1646. file( READ ${_src} _src_data )
  1647. string( REPLACE ";" "|" _keywords_match "(${_keywords_desktop})" )
  1648. string( REGEX REPLACE "(^|\n)${_keywords_match}[ ]*=[ ]*" "\\1_\\2=" _src_data "${_src_data}" )
  1649. file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.in "${_src_data}" )
  1650. # merge translations command
  1651. add_custom_command(
  1652. OUTPUT ${_basename}
  1653. COMMAND ${INTLTOOL_MERGE_EXECUTABLE} -d ${_po_dir} ${_basename}.in ${_basename}
  1654. DEPENDS ${_src}
  1655. )
  1656. endif( )
  1657. # merge translations target
  1658. add_custom_target( "${_target}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_basename} )
  1659. endif()
  1660. else( )
  1661. # just write the original file without translations
  1662. file( READ ${_src} _src_data )
  1663. file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_basename} "${_src_data}" )
  1664. endif( )
  1665. # install traslated desktop file
  1666. if( NOT "${_dest}" STREQUAL "-" )
  1667. install(
  1668. FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}
  1669. RENAME ${_out_name}
  1670. DESTINATION ${_dest}
  1671. )
  1672. endif()
  1673. endforeach()
  1674. endmacro( )
  1675. #################################################
  1676. #####
  1677. ##### tde_create_handbook
  1678. macro( tde_create_handbook )
  1679. unset( _target )
  1680. unset( _dest )
  1681. unset( _noindex )
  1682. unset( _srcs )
  1683. unset( _extra )
  1684. unset( _srcdir )
  1685. get_filename_component( _source_basedir "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE )
  1686. set( _lang en )
  1687. set( _first_arg 1 )
  1688. set( _var _target )
  1689. foreach( _arg ${ARGN} )
  1690. # found directive "SOURCE_BASEDIR"
  1691. if( "+${_arg}" STREQUAL "+SOURCE_BASEDIR" )
  1692. unset( _source_basedir )
  1693. set( _var _source_basedir )
  1694. set( _directive 1 )
  1695. endif()
  1696. # found directive "NOINDEX"
  1697. if( "+${_arg}" STREQUAL "+NOINDEX" )
  1698. set( _noindex 1 )
  1699. set( _directive 1 )
  1700. endif()
  1701. # found directive "FILES"
  1702. if( "+${_arg}" STREQUAL "+FILES" )
  1703. unset( _srcs )
  1704. set( _var _srcs )
  1705. set( _directive 1 )
  1706. endif()
  1707. # found directive "EXTRA"
  1708. if( "+${_arg}" STREQUAL "+EXTRA" )
  1709. unset( _extra )
  1710. set( _var _extra )
  1711. set( _directive 1 )
  1712. endif()
  1713. # found directive "SRCDIR"
  1714. if( "+${_arg}" STREQUAL "+SRCDIR" )
  1715. unset( _srcdir )
  1716. set( _var _srcdir )
  1717. set( _directive 1 )
  1718. endif()
  1719. # found directive DESTINATION
  1720. if( "+${_arg}" STREQUAL "+DESTINATION" )
  1721. unset( _dest )
  1722. set( _var _dest )
  1723. set( _directive 1 )
  1724. endif()
  1725. # found directive "LANG"
  1726. if( "+${_arg}" STREQUAL "+LANG" )
  1727. unset( _lang )
  1728. set( _var _lang )
  1729. set( _directive 1 )
  1730. endif()
  1731. # collect data
  1732. if( _directive )
  1733. unset( _directive )
  1734. elseif( _var )
  1735. if( _first_arg )
  1736. set( _target "${_arg}" )
  1737. else()
  1738. list( APPEND ${_var} ${_arg} )
  1739. endif()
  1740. endif()
  1741. unset( _first_arg )
  1742. endforeach()
  1743. # if source_basedir is relative, complete the path to absolute
  1744. if( NOT IS_ABSOLUTE ${_source_basedir} )
  1745. get_filename_component( _source_basedir "${_source_basedir}" ABSOLUTE )
  1746. endif()
  1747. # prepare the binary directory according to source_basedir
  1748. file( RELATIVE_PATH _binary_basedir "${CMAKE_CURRENT_SOURCE_DIR}" "${_source_basedir}" )
  1749. set( _binary_basedir "${CMAKE_CURRENT_BINARY_DIR}/${_binary_basedir}" )
  1750. file( MAKE_DIRECTORY "${_binary_basedir}" )
  1751. # if no target specified, try to guess it from DESTINATION
  1752. if( NOT _target )
  1753. if( NOT _dest )
  1754. tde_message_fatal( "target name cannot be determined because DESTINATION is not set" )
  1755. endif()
  1756. string( REPLACE "/" "-" _target "${_dest}" )
  1757. endif()
  1758. set( _target "${_target}-${_lang}-handbook" )
  1759. # if sources are listed, complete the path to absolute
  1760. if( _srcs )
  1761. foreach( _src ${_srcs} )
  1762. if( NOT IS_ABSOLUTE ${_src} )
  1763. list( REMOVE_ITEM _srcs ${_src} )
  1764. get_filename_component( _src "${_source_basedir}/${_src}" ABSOLUTE )
  1765. list( APPEND _srcs ${_src} )
  1766. endif()
  1767. endforeach()
  1768. endif()
  1769. # if no file specified, include all docbooks, stylesheets and images
  1770. if( NOT _srcs )
  1771. file( GLOB _srcs
  1772. ${_source_basedir}/*.docbook
  1773. ${_source_basedir}/*.css
  1774. ${_source_basedir}/*.png
  1775. )
  1776. endif()
  1777. # if no destination specified, defaulting to HTML_INSTALL_DIR
  1778. if( NOT _dest )
  1779. set( _dest "${HTML_INSTALL_DIR}/${_lang}" )
  1780. # if destination is NOT absolute path,
  1781. # we assume that is relative to HTML_INSTALL_DIR
  1782. elseif( NOT IS_ABSOLUTE ${_dest} )
  1783. set( _dest "${HTML_INSTALL_DIR}/${_lang}/${_dest}" )
  1784. endif()
  1785. if( NOT _srcs )
  1786. tde_message_fatal( "no source files" )
  1787. endif()
  1788. if( NOT _noindex )
  1789. # check for index.docbook
  1790. list( FIND _srcs "${_source_basedir}/index.docbook" _find_index )
  1791. if( -1 EQUAL _find_index )
  1792. tde_message_fatal( "missing index.docbook file" )
  1793. endif()
  1794. # check for srcdir
  1795. if( _srcdir )
  1796. set( _srcdir "--srcdir=${_srcdir}" )
  1797. endif()
  1798. add_custom_command(
  1799. OUTPUT ${_binary_basedir}/index.cache.bz2
  1800. COMMAND ${KDE3_MEINPROC_EXECUTABLE} ${_srcdir} --check --cache index.cache.bz2 ${_source_basedir}/index.docbook
  1801. COMMENT "Generating ${_target}"
  1802. DEPENDS ${_srcs}
  1803. WORKING_DIRECTORY "${_binary_basedir}"
  1804. )
  1805. add_custom_target( ${_target} ALL DEPENDS ${_binary_basedir}/index.cache.bz2 )
  1806. list( APPEND _srcs ${_binary_basedir}/index.cache.bz2 )
  1807. if( NOT TDE_HTML_DIR )
  1808. set( TDE_HTML_DIR ${HTML_INSTALL_DIR} )
  1809. endif( )
  1810. tde_install_empty_directory( ${_dest} )
  1811. tde_install_symlink( ${TDE_HTML_DIR}/${_lang}/common ${_dest} )
  1812. endif()
  1813. install( FILES ${_srcs} ${_extra} DESTINATION ${_dest} )
  1814. endmacro( )
  1815. #################################################
  1816. #####
  1817. ##### tde_create_tarball
  1818. #####
  1819. ##### Macro is used to create tarball.
  1820. #####
  1821. macro( tde_create_tarball )
  1822. unset( _target )
  1823. unset( _files )
  1824. unset( _destination )
  1825. set( _sourcedir "${CMAKE_CURRENT_SOURCE_DIR}" )
  1826. set( _compression "gzip" )
  1827. set( _var _target )
  1828. foreach( _arg ${ARGN} )
  1829. # found directive "TARGET"
  1830. if( "+${_arg}" STREQUAL "+TARGET" )
  1831. unset( _target )
  1832. set( _var _target )
  1833. set( _directive 1 )
  1834. endif( )
  1835. # found directive "SOURCEDIR"
  1836. if( "+${_arg}" STREQUAL "+SOURCEDIR" )
  1837. unset( _sourcedir )
  1838. set( _var _sourcedir )
  1839. set( _directive 1 )
  1840. endif( )
  1841. # found directive "FILES"
  1842. if( "+${_arg}" STREQUAL "+FILES" )
  1843. unset( _files )
  1844. set( _var _files )
  1845. set( _directive 1 )
  1846. endif( )
  1847. # found directive "DESTINATION"
  1848. if( "+${_arg}" STREQUAL "+DESTINATION" )
  1849. unset( _destination )
  1850. set( _var _destination )
  1851. set( _directive 1 )
  1852. endif( )
  1853. # found directive "COMPRESSION"
  1854. if( "+${_arg}" STREQUAL "+COMPRESSION" )
  1855. unset( _compression )
  1856. set( _var _compression )
  1857. set( _directive 1 )
  1858. endif( )
  1859. # collect data
  1860. if( _directive )
  1861. unset( _directive )
  1862. elseif( _var )
  1863. list( APPEND ${_var} ${_arg} )
  1864. endif( )
  1865. endforeach( )
  1866. if( NOT _target )
  1867. tde_message_fatal( "Target tarball name not specified." )
  1868. endif( )
  1869. if( NOT IS_ABSOLUTE ${_sourcedir} )
  1870. set( _sourcedir "${CMAKE_CURRENT_SOURCE_DIR}/${_sourcedir}" )
  1871. endif( )
  1872. if( NOT _files )
  1873. file( GLOB_RECURSE _files RELATIVE ${_sourcedir} "${_sourcedir}/*" )
  1874. list( SORT _files )
  1875. endif( )
  1876. unset( _files_deps )
  1877. foreach( _file ${_files} )
  1878. list( APPEND _files_deps "${_sourcedir}/${_file}" )
  1879. endforeach( )
  1880. if( NOT DEFINED TAR_EXECUTABLE )
  1881. find_program( TAR_EXECUTABLE NAMES tar )
  1882. if( "${TAR_EXECUTABLE}" STREQUAL "TAR_EXECUTABLE-NOTFOUND" )
  1883. tde_message_fatal( "tar executable is required but not found on your system" )
  1884. endif( )
  1885. endif( )
  1886. if( NOT DEFINED TAR_SETOWNER )
  1887. execute_process(
  1888. COMMAND ${TAR_EXECUTABLE} --version
  1889. OUTPUT_VARIABLE TAR_VERSION
  1890. )
  1891. string( REGEX REPLACE "^([^\n]*)\n.*" "\\1" TAR_VERSION "${TAR_VERSION}" )
  1892. if( "${TAR_VERSION}" MATCHES "GNU *tar" )
  1893. set( TAR_SETOWNER "--owner=root;--group=root" )
  1894. set( TAR_REPRODUCIBLE "--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime" )
  1895. tde_read_src_metadata()
  1896. if( TDE_PKG_DATETIME )
  1897. list( APPEND TAR_REPRODUCIBLE --mtime "${TDE_PKG_DATETIME}" )
  1898. elseif( TDE_SCM_MODULE_DATETIME )
  1899. list( APPEND TAR_REPRODUCIBLE --mtime "${TDE_SCM_MODULE_DATETIME}" )
  1900. endif( )
  1901. elseif( "${TAR_VERSION}" MATCHES "bsd *tar" )
  1902. set( TAR_SETOWNER "--uname=root;--gname=root" )
  1903. else( )
  1904. set( TAR_SETOWNER "" )
  1905. endif( )
  1906. endif( )
  1907. if( "${_compression}" STREQUAL "-" )
  1908. unset( _compression )
  1909. endif( )
  1910. if( _compression )
  1911. if( "${_compression}" STREQUAL "gzip" )
  1912. set( TAR_COMPRESSION "|" ${_compression} "-n" )
  1913. else( )
  1914. set( TAR_COMPRESSION "|" ${_compression} )
  1915. endif( )
  1916. endif( )
  1917. get_filename_component( _target_path "${CMAKE_CURRENT_BINARY_DIR}/${_target}" ABSOLUTE )
  1918. file( RELATIVE_PATH _target_path "${CMAKE_BINARY_DIR}" "${_target_path}" )
  1919. string( REPLACE "/" "+" _target_name "${_target_path}" )
  1920. add_custom_target( "${_target_name}-tarball" ALL
  1921. DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_target}" )
  1922. add_custom_command(
  1923. COMMAND ${TAR_EXECUTABLE} cf -
  1924. ${TAR_SETOWNER} ${TAR_REPRODUCIBLE} -- ${_files}
  1925. ${TAR_COMPRESSION} > ${CMAKE_CURRENT_BINARY_DIR}/${_target}
  1926. WORKING_DIRECTORY "${_sourcedir}"
  1927. OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_target}"
  1928. DEPENDS ${_files_deps}
  1929. COMMENT "Create tarball ${_target_path}"
  1930. )
  1931. if( _destination )
  1932. install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${_target} DESTINATION ${_destination} )
  1933. endif( )
  1934. endmacro()
  1935. #################################################
  1936. #####
  1937. ##### tde_include_tqt
  1938. macro( tde_include_tqt )
  1939. foreach( _cpp ${ARGN} )
  1940. set_source_files_properties( ${_cpp} PROPERTIES COMPILE_FLAGS "-include tqt.h" )
  1941. endforeach()
  1942. endmacro( )
  1943. #################################################
  1944. #####
  1945. ##### tde_install_symlink
  1946. macro( tde_install_symlink _target _link )
  1947. # if path is relative, we must to prefix it with CMAKE_INSTALL_PREFIX
  1948. if( IS_ABSOLUTE "${_link}" )
  1949. set( _destination "${_link}" )
  1950. else( IS_ABSOLUTE "${_link}" )
  1951. set( _destination "${CMAKE_INSTALL_PREFIX}/${_link}" )
  1952. endif( IS_ABSOLUTE "${_link}" )
  1953. get_filename_component( _path "${_destination}" PATH )
  1954. if( NOT IS_DIRECTORY "\$ENV{DESTDIR}${_path}" )
  1955. install( CODE "file( MAKE_DIRECTORY \"\$ENV{DESTDIR}${_path}\" )" )
  1956. endif( NOT IS_DIRECTORY "\$ENV{DESTDIR}${_path}" )
  1957. install( CODE "execute_process( COMMAND ln -s ${_target} \$ENV{DESTDIR}${_destination} )" )
  1958. endmacro( tde_install_symlink )
  1959. #################################################
  1960. #####
  1961. ##### tde_install_empty_directory
  1962. macro( tde_install_empty_directory _path )
  1963. # if path is relative, we must to prefix it with CMAKE_INSTALL_PREFIX
  1964. if( IS_ABSOLUTE "${_path}" )
  1965. set( _destination "${_path}" )
  1966. else( IS_ABSOLUTE "${_path}" )
  1967. set( _destination "${CMAKE_INSTALL_PREFIX}/${_path}" )
  1968. endif( IS_ABSOLUTE "${_path}" )
  1969. install( CODE "file( MAKE_DIRECTORY \"\$ENV{DESTDIR}${_destination}\" )" )
  1970. endmacro( tde_install_empty_directory )
  1971. #################################################
  1972. #####
  1973. ##### tde_conditional_add_subdirectory
  1974. macro( tde_conditional_add_subdirectory _cond _path )
  1975. if( ${_cond} )
  1976. add_subdirectory( "${_path}" )
  1977. endif( ${_cond} )
  1978. endmacro( tde_conditional_add_subdirectory )
  1979. #################################################
  1980. #####
  1981. ##### tde_auto_add_subdirectories
  1982. macro( tde_auto_add_subdirectories )
  1983. file( GLOB _dirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} * )
  1984. foreach( _dir ${_dirs} )
  1985. if( IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_dir} )
  1986. if( NOT ${_dir} STREQUAL ".svn" AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_dir}/CMakeLists.txt )
  1987. add_subdirectory( ${_dir} )
  1988. endif()
  1989. endif()
  1990. endforeach()
  1991. endmacro()
  1992. #################################################
  1993. #####
  1994. ##### tde_save / tde_restore
  1995. macro( tde_save )
  1996. foreach( _var ${ARGN} )
  1997. set( __bak_${_var} ${${_var}} )
  1998. endforeach()
  1999. endmacro()
  2000. macro( tde_save_and_set _var )
  2001. set( __bak_${_var} ${${_var}} )
  2002. set( ${_var} ${ARGN} )
  2003. endmacro( )
  2004. macro( tde_restore )
  2005. foreach( _var ${ARGN} )
  2006. set( ${_var} ${__bak_${_var}} )
  2007. unset( __bak_${_var} )
  2008. endforeach()
  2009. endmacro()
  2010. #################################################
  2011. #####
  2012. ##### tde_setup_install_path
  2013. macro( tde_setup_install_path _path _default )
  2014. if( DEFINED ${_path} )
  2015. set( ${_path} "${${_path}}" CACHE INTERNAL "" FORCE )
  2016. else( )
  2017. set( ${_path} "${_default}" )
  2018. endif( )
  2019. endmacro( )
  2020. ##################################################
  2021. if( ${CMAKE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR} )
  2022. tde_message_fatal( "Please use out-of-source building, like this:
  2023. \n rm ${CMAKE_SOURCE_DIR}/CMakeCache.txt
  2024. mkdir /tmp/${PROJECT_NAME}.build
  2025. cd /tmp/${PROJECT_NAME}.build
  2026. cmake ${CMAKE_SOURCE_DIR} [arguments...]" )
  2027. endif( )
  2028. #################################################
  2029. #####
  2030. ##### tde_setup_architecture_flags
  2031. macro( tde_setup_architecture_flags )
  2032. if( NOT DEFINED LINKER_IMMEDIATE_BINDING_FLAGS )
  2033. message( STATUS "Detected ${CMAKE_SYSTEM_PROCESSOR} CPU architecture" )
  2034. ## Immediate symbol binding is available only for gcc but not on ARM architectures
  2035. if( ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" AND NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES arm* AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" )
  2036. set( LINKER_IMMEDIATE_BINDING_FLAGS "-z\ now" CACHE INTERNAL "" FORCE )
  2037. else( )
  2038. set( LINKER_IMMEDIATE_BINDING_FLAGS "" CACHE INTERNAL "" FORCE )
  2039. endif( )
  2040. check_cxx_compiler_flag( -fPIE HAVE_PIE_SUPPORT )
  2041. if( HAVE_PIE_SUPPORT )
  2042. set( TDE_PIE_CFLAGS -fPIE )
  2043. set( TDE_PIE_LDFLAGS -pie )
  2044. endif( HAVE_PIE_SUPPORT )
  2045. endif( )
  2046. endmacro( )
  2047. #################################################
  2048. #####
  2049. ##### tde_setup_gcc_visibility
  2050. macro( tde_setup_gcc_visibility )
  2051. if( NOT DEFINED __KDE_HAVE_GCC_VISIBILITY )
  2052. if( NOT UNIX )
  2053. tde_message_fatal( "gcc visibility support was requested, but your system is not *NIX" )
  2054. endif( NOT UNIX )
  2055. if( TQT_FOUND AND NOT DEFINED HAVE_TQT_VISIBILITY )
  2056. find_library( TQT_LIBFILE tqt-mt HINTS "${TQT_LIBRARY_DIRS}" )
  2057. if( NOT "${TQT_LIBFILE}" STREQUAL "TQT_LIBFILE-NOTFOUND" )
  2058. message( STATUS "Performing Test HAVE_TQT_VISIBILITY" )
  2059. execute_process(
  2060. COMMAND readelf --syms "${TQT_LIBFILE}"
  2061. OUTPUT_VARIABLE HAVE_TQT_VISIBILITY
  2062. )
  2063. if( "${HAVE_TQT_VISIBILITY}" STREQUAL "" OR
  2064. "${HAVE_TQT_VISIBILITY}" MATCHES "GLOBAL[\t ]+DEFAULT[^\n]+QSettingsPrivate" )
  2065. message( STATUS "Performing Test HAVE_TQT_VISIBILITY - Failed" )
  2066. tde_message_fatal( "gcc visibility support was requested, but not supported in tqt library" )
  2067. endif( )
  2068. set( HAVE_TQT_VISIBILITY 1 CACHE INTERNAL "" )
  2069. message( STATUS "Performing Test HAVE_TQT_VISIBILITY - Success" )
  2070. endif( )
  2071. endif( TQT_FOUND AND NOT DEFINED HAVE_TQT_VISIBILITY )
  2072. if( TDE_FOUND AND NOT DEFINED HAVE_TDE_VISIBILITY )
  2073. find_file( TDEMACROS_H kdemacros.h HINTS "${TDE_INCLUDE_DIR}" )
  2074. if( NOT "${TDEMACROS_H}" STREQUAL "TDEMACROS_H-NOTFOUND" )
  2075. tde_save_and_set( CMAKE_REQUIRED_INCLUDES "${TDE_INCLUDE_DIR}" )
  2076. check_cxx_source_compiles( "
  2077. #include <${TDEMACROS_H}>
  2078. #ifndef __KDE_HAVE_GCC_VISIBILITY
  2079. #error gcc visibility is not enabled in tdelibs
  2080. #endif
  2081. int main() { return 0; } "
  2082. HAVE_TDE_VISIBILITY
  2083. )
  2084. tde_restore( CMAKE_REQUIRED_INCLUDES )
  2085. if( NOT HAVE_TDE_VISIBILITY )
  2086. tde_message_fatal( "gcc visibility support was requested, but not supported in tdelibs" )
  2087. endif( NOT HAVE_TDE_VISIBILITY )
  2088. endif( )
  2089. endif( TDE_FOUND AND NOT DEFINED HAVE_TDE_VISIBILITY )
  2090. set( __KDE_HAVE_GCC_VISIBILITY 1 CACHE INTERNAL "" )
  2091. set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
  2092. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
  2093. endif( )
  2094. endmacro( )
  2095. #################################################
  2096. #####
  2097. ##### tde_setup_msgfmt
  2098. macro( tde_setup_msgfmt )
  2099. if( NOT DEFINED MSGFMT_EXECUTABLE )
  2100. include( FindGettext )
  2101. if( GETTEXT_FOUND )
  2102. set( MSGFMT_EXECUTABLE ${GETTEXT_MSGFMT_EXECUTABLE}
  2103. CACHE FILEPATH "path to msgfmt executable" )
  2104. if( GETTEXT_VERSION_STRING )
  2105. set( MSGFMT_VERSION ${GETTEXT_VERSION_STRING}
  2106. CACHE STRING "version of msgfmt executable" )
  2107. endif( )
  2108. endif( GETTEXT_FOUND )
  2109. if( NOT MSGFMT_EXECUTABLE )
  2110. tde_message_fatal( "msgfmt is required but was not found on your system." )
  2111. endif( NOT MSGFMT_EXECUTABLE )
  2112. endif( )
  2113. if( NOT MSGFMT_VERSION )
  2114. execute_process(
  2115. COMMAND ${MSGFMT_EXECUTABLE} --version
  2116. OUTPUT_VARIABLE _msgfmt_version
  2117. ERROR_VARIABLE _msgfmt_version
  2118. )
  2119. string( REGEX REPLACE "^msgfmt[^\n]* ([^ ]*)\n.*" "\\1" _msgfmt_version ${_msgfmt_version} )
  2120. set( MSGFMT_VERSION ${_msgfmt_version}
  2121. CACHE STRING "version of msgfmt executable" )
  2122. endif( )
  2123. endmacro( )
  2124. ################################################
  2125. #####
  2126. ##### tde_setup_largefiles
  2127. macro( tde_setup_largefiles )
  2128. if( NOT DEFINED HAVE_LARGEFILES )
  2129. message( STATUS "Check support for large files" )
  2130. unset( LARGEFILES_DEFINITIONS )
  2131. # check without special definitions
  2132. unset( HAVE_SIZEOF_T CACHE )
  2133. check_type_size( off_t SIZEOF_OFF_T )
  2134. if( SIZEOF_OFF_T GREATER 7 )
  2135. set( HAVE_LARGEFILES 1 )
  2136. endif( )
  2137. # check with definition _FILE_OFFSET_BITS=64
  2138. if( NOT HAVE_LARGEFILES )
  2139. unset( HAVE_SIZEOF_OFF_T CACHE )
  2140. tde_save_and_set( CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_FILE_OFFSET_BITS=64" )
  2141. check_type_size( off_t SIZEOF_OFF_T )
  2142. tde_restore( CMAKE_REQUIRED_DEFINITIONS )
  2143. if( SIZEOF_OFF_T GREATER 7 )
  2144. set( LARGEFILES_DEFINITIONS "-D_FILE_OFFSET_BITS=64" )
  2145. set( HAVE_LARGEFILES 1 )
  2146. endif( )
  2147. endif( )
  2148. # check with definition _LARGE_FILES
  2149. if( NOT HAVE_LARGEFILES )
  2150. unset( HAVE_SIZEOF_OFF_T CACHE )
  2151. tde_save_and_set( CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_LARGE_FILES" )
  2152. check_type_size( off_t SIZEOF_OFF_T )
  2153. tde_restore( CMAKE_REQUIRED_DEFINITIONS )
  2154. if( SIZEOF_OFF_T GREATER 7 )
  2155. set( LARGEFILES_DEFINITIONS "-D_LARGE_FILES" )
  2156. set( HAVE_LARGEFILES 1 )
  2157. endif( )
  2158. endif( )
  2159. # check with definition _LARGEFILE_SOURCE
  2160. if( NOT HAVE_LARGEFILES )
  2161. unset( HAVE_SIZEOF_OFF_T CACHE )
  2162. tde_save_and_set( CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_LARGEFILE_SOURCE" )
  2163. check_type_size( off_t SIZEOF_OFF_T )
  2164. tde_restore( CMAKE_REQUIRED_DEFINITIONS )
  2165. if( SIZEOF_OFF_T GREATER 7 )
  2166. set( LARGEFILES_DEFINITIONS "-D_LARGEFILE_SOURCE" )
  2167. set( HAVE_LARGEFILES 1 )
  2168. endif( )
  2169. endif( )
  2170. # check for fseeko/ftello
  2171. if( HAVE_LARGEFILES )
  2172. tde_save_and_set( CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} ${LARGEFILES_DEFINITIONS}" )
  2173. check_symbol_exists( "fseeko" "stdio.h" HAVE_FSEEKO )
  2174. tde_restore( CMAKE_REQUIRED_DEFINITIONS )
  2175. if( NOT HAVE_FSEEKO )
  2176. tde_save_and_set( CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} ${LARGEFILES_DEFINITIONS} -D_LARGEFILE_SOURCE" )
  2177. check_symbol_exists( "fseeko" "stdio.h" HAVE_FSEEKO )
  2178. tde_restore( CMAKE_REQUIRED_DEFINITIONS )
  2179. if( HAVE_FSEEKO )
  2180. set( LARGEFILES_DEFINITIONS "${LARGEFILES_DEFINITIONS} -D_LARGEFILE_SOURCE" )
  2181. else( )
  2182. unset( HAVE_LARGEFILES )
  2183. endif( )
  2184. endif( )
  2185. endif( )
  2186. # check results
  2187. if( HAVE_LARGEFILES )
  2188. if( "${LARGEFILES_DEFINITIONS}" STREQUAL "" )
  2189. message( STATUS "Check support for large files - Success" )
  2190. else( )
  2191. add_definitions( ${LARGEFILES_DEFINITIONS} )
  2192. message( STATUS "Check support for large files - Success with ${LARGEFILES_DEFINITIONS}" )
  2193. endif( )
  2194. set( HAVE_LARGEFILES 1 CACHE INTERNAL "Support for large files enabled" )
  2195. else( )
  2196. message( STATUS "Check support for large files - Failed" )
  2197. tde_message_fatal( "Cannot find a way to enable support for large files." )
  2198. endif( )
  2199. endif( )
  2200. endmacro( )
  2201. #################################################
  2202. #####
  2203. ##### tde_setup_dbus
  2204. macro( tde_setup_dbus )
  2205. if( NOT DBUS_FOUND )
  2206. pkg_search_module( DBUS dbus-1 )
  2207. if( NOT DBUS_FOUND )
  2208. tde_message_fatal( "dbus-1 is required, but not found on your system" )
  2209. endif( )
  2210. endif( )
  2211. if( NOT DEFINED DBUS_SYSTEM_CONF_DIRECTORY )
  2212. execute_process(
  2213. COMMAND ${PKG_CONFIG_EXECUTABLE}
  2214. dbus-1 --variable=sysconfdir
  2215. OUTPUT_VARIABLE DBUS_SYSTEM_CONF_BASE
  2216. OUTPUT_STRIP_TRAILING_WHITESPACE
  2217. )
  2218. if( DBUS_SYSTEM_CONF_BASE )
  2219. set( DBUS_SYSTEM_CONF_DIRECTORY "${DBUS_SYSTEM_CONF_BASE}/dbus-1/system.d"
  2220. CACHE PATH "Path for DBUS system configuration files" )
  2221. message( STATUS "Using " ${DBUS_SYSTEM_CONF_DIRECTORY} " for DBUS system configuration files" )
  2222. else( )
  2223. tde_message_fatal( "Can not find the base directory for the dbus-1 configuration" )
  2224. endif( )
  2225. endif( )
  2226. if( NOT DEFINED DBUS_SESSION_CONF_DIRECTORY )
  2227. execute_process(
  2228. COMMAND ${PKG_CONFIG_EXECUTABLE}
  2229. dbus-1 --variable=sysconfdir
  2230. OUTPUT_VARIABLE DBUS_SYSTEM_CONF_BASE
  2231. OUTPUT_STRIP_TRAILING_WHITESPACE
  2232. )
  2233. if( DBUS_SYSTEM_CONF_BASE )
  2234. set( DBUS_SESSION_CONF_DIRECTORY "${DBUS_SYSTEM_CONF_BASE}/dbus-1/session.d"
  2235. CACHE PATH "Path for DBUS session configuration files" )
  2236. message( STATUS "Using " ${DBUS_SESSION_CONF_DIRECTORY} " for DBUS session configuration files" )
  2237. else( )
  2238. tde_message_fatal( "Can not find the base directory for the dbus-1 configuration" )
  2239. endif( )
  2240. endif( )
  2241. if( NOT DEFINED DBUS_SESSION_DIRECTORY )
  2242. execute_process(
  2243. COMMAND ${PKG_CONFIG_EXECUTABLE}
  2244. dbus-1 --variable=session_bus_services_dir
  2245. OUTPUT_VARIABLE DBUS_SESSION_DIRECTORY
  2246. OUTPUT_STRIP_TRAILING_WHITESPACE
  2247. )
  2248. set( DBUS_SESSION_DIRECTORY "${DBUS_SESSION_DIRECTORY}"
  2249. CACHE PATH "Path for DBUS session service files" )
  2250. message( STATUS "Using " ${DBUS_SESSION_DIRECTORY} " for DBUS session service files" )
  2251. endif( )
  2252. if( NOT DEFINED DBUS_SERVICE_DIRECTORY )
  2253. execute_process(
  2254. COMMAND ${PKG_CONFIG_EXECUTABLE}
  2255. dbus-1 --variable=system_bus_services_dir
  2256. OUTPUT_VARIABLE DBUS_SERVICE_DIRECTORY
  2257. OUTPUT_STRIP_TRAILING_WHITESPACE
  2258. )
  2259. if( "${DBUS_SERVICE_DIRECTORY}" STREQUAL "" )
  2260. if( "${DBUS_SESSION_DIRECTORY}" MATCHES "/services$" )
  2261. string( REGEX REPLACE "/services$" "/system-services"
  2262. DBUS_SERVICE_DIRECTORY "${DBUS_SESSION_DIRECTORY}" )
  2263. else( )
  2264. tde_message_fatal( "Directory for DBUS system service files can not be determined." )
  2265. endif( )
  2266. endif( )
  2267. set( DBUS_SERVICE_DIRECTORY "${DBUS_SERVICE_DIRECTORY}"
  2268. CACHE PATH "Path for DBUS system service files" )
  2269. message( STATUS "Using " ${DBUS_SERVICE_DIRECTORY} " for DBUS system service files" )
  2270. endif( )
  2271. if( NOT "${ARGV}" STREQUAL "" AND NOT DBUS_TQT_FOUND )
  2272. pkg_search_module( DBUS_TQT ${ARGV} )
  2273. if( NOT DBUS_TQT_FOUND )
  2274. tde_message_fatal( "${ARGV} is required, but not found on your system" )
  2275. endif( )
  2276. endif( )
  2277. if( "${ARGV}" STREQUAL "dbus-1-tqt" AND NOT DEFINED DBUSXML2QT3_EXECUTABLE )
  2278. find_program( DBUSXML2QT3_EXECUTABLE
  2279. NAMES dbusxml2qt3
  2280. HINTS "${TDE_PREFIX}/bin" ${BIN_INSTALL_DIR}
  2281. )
  2282. endif( )
  2283. endmacro( )
  2284. #################################################
  2285. #####
  2286. ##### tde_setup_polkit
  2287. macro( tde_setup_polkit )
  2288. if( NOT POLKIT_GOBJECT_FOUND )
  2289. pkg_search_module( POLKIT_GOBJECT polkit-gobject-1 )
  2290. if( NOT POLKIT_GOBJECT_FOUND )
  2291. tde_message_fatal( "polkit-gobject-1 is required, but not found on your system" )
  2292. endif( )
  2293. endif( )
  2294. foreach( _arg ${ARGV} )
  2295. if( NOT "${_arg}" MATCHES "^polkit-" )
  2296. set( _arg "polkit-${_arg}" )
  2297. endif( )
  2298. string( TOUPPER "${_arg}" _polkit_module )
  2299. if( "${_polkit_module}" MATCHES "-[0-9]+$" )
  2300. string( REGEX REPLACE "-[0-9]+$" "" _polkit_module "${_polkit_module}" )
  2301. endif( )
  2302. string( REPLACE "-" "_" _polkit_module "${_polkit_module}" )
  2303. if( NOT "${_arg}" MATCHES "-[0-9]+$" )
  2304. set( _arg "${_arg}-1" )
  2305. endif( )
  2306. if( NOT ${_polkit_module}_FOUND )
  2307. pkg_search_module( ${_polkit_module} ${_arg} )
  2308. if( NOT ${_polkit_module}_FOUND )
  2309. tde_message_fatal( "${_arg} is required, but not found on your system" )
  2310. endif( )
  2311. endif( )
  2312. endforeach( )
  2313. if( NOT DEFINED POLKIT_ACTIONS_DIRECTORY )
  2314. execute_process(
  2315. COMMAND ${PKG_CONFIG_EXECUTABLE}
  2316. polkit-gobject-1 --variable=actiondir
  2317. OUTPUT_VARIABLE POLKIT_ACTIONS_DIRECTORY
  2318. OUTPUT_STRIP_TRAILING_WHITESPACE
  2319. )
  2320. set( POLKIT_ACTIONS_DIRECTORY "${POLKIT_ACTIONS_DIRECTORY}"
  2321. CACHE PATH "Path for PolicyKit action files" )
  2322. message( STATUS "Using " ${POLKIT_ACTIONS_DIRECTORY} " for PolicyKit action files" )
  2323. endif( )
  2324. endmacro( )