summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: 58abee4bcce5d8019a9db6b63f20591d87287c98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#################################################
#
#  (C) 2020-2022 Slávek Banko
#  slavek.banko (AT) axis.cz
#
#  Improvements and feedback are welcome
#
#  This file is released under GPL >= 2
#
#################################################


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

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


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

project( koffice-i18n )


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

include( FindPkgConfig ) # required for find_package( TDE )


##### include our cmake modules #################

include( TDEMacros )


##### find required stuff #######################

find_package( TDE )

include( TDESetupPaths )
tde_setup_paths( )


##### process languages #########################

file( GLOB _dirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} * )
list( SORT _dirs )

string( REGEX REPLACE "[ \r\n\t]+" ";" _linguas "$ENV{LINGUAS}" )

foreach( _dir IN LISTS _dirs )
  string( REGEX REPLACE "^${PROJECT_NAME}-" "" _lang "${_dir}" )
  if( "${_dir}" MATCHES "^${PROJECT_NAME}-"
      AND IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_dir}
      AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_dir}/CMakeLists.txt
      AND ( "${_lang}" STREQUAL "en" OR
            "${_linguas}" MATCHES "^;*$" OR
            ";${_linguas};" MATCHES ";${_lang};" ))
    add_subdirectory( ${_dir} )
    string( REGEX REPLACE "@" "_" _lang_target "${_lang}" )
    add_custom_target( install-${_lang_target}
      COMMAND ${CMAKE_COMMAND}
        -DCOMPONENT=${_lang}
        -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
    )
  endif()
endforeach()