summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2021-05-25 19:15:23 +0200
committerSlávek Banko <slavek.banko@axis.cz>2021-05-27 10:24:55 +0200
commite40bf7bd0f42fd5d46e2d1880cbfcc64432bae9c (patch)
treedbf76c8bec87c9830d1a8aacbc35d7dcffae065b /CMakeLists.txt
parentf6bd909bcf68ab7f1644a87023bcee18be90276b (diff)
downloadtde-i18n-e40bf7bd0f42fd5d46e2d1880cbfcc64432bae9c.tar.gz
tde-i18n-e40bf7bd0f42fd5d46e2d1880cbfcc64432bae9c.zip
Add a top-level CMake rules that allows to build all languages
depending on the setting of the LINGUAS environment variable. To enable separate installation of individual languages, there are individual targets with "install-<lang>" format. Don't use it with standard make, because due to the huge number of targets, it has a huge overhead and therefore provides lousy performance! Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit e8e67953cac11ae86c090194ed0ce05adf7c6d41)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt63
1 files changed, 63 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 00000000000..fb3e0350f7a
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,63 @@
+#################################################
+#
+# (C) 2021 Slávek Banko
+# slavek.banko (AT) axis.cz
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+cmake_minimum_required( VERSION 2.8.12 )
+
+
+##### general package setup #####################
+
+project( tde-i18n )
+set( VERSION R14.0.11 )
+
+
+##### include essential cmake modules ###########
+
+include( FindPkgConfig ) # required for find_package( TDE )
+
+
+##### include our cmake modules #################
+
+set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/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()