summaryrefslogtreecommitdiffstats
path: root/template/commonCMakeLists.txt
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2020-11-19 03:02:00 +0100
committerSlávek Banko <slavek.banko@axis.cz>2020-11-20 23:48:51 +0100
commit84835f6d92ac44ce93e4908a08138f2afcae1c66 (patch)
tree1fdd3ce398316b86af7dd136892824e1643d76fe /template/commonCMakeLists.txt
parentd403f64ec9ca093f055cca1d3b154a5a2f3954f5 (diff)
downloadtde-i18n-84835f6d92ac44ce93e4908a08138f2afcae1c66.tar.gz
tde-i18n-84835f6d92ac44ce93e4908a08138f2afcae1c66.zip
Use universal common rules instead of many individual CMakeListst.txt files.
Note: For systems and distributions where individual language directories are unpacked for building, you need to add an unpacking for the 'template' directory in addition to the 'cmake' directory. Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit 6d747afe2f2250a9f25adb3c758a91fc21520e74)
Diffstat (limited to 'template/commonCMakeLists.txt')
-rw-r--r--template/commonCMakeLists.txt167
1 files changed, 167 insertions, 0 deletions
diff --git a/template/commonCMakeLists.txt b/template/commonCMakeLists.txt
new file mode 100644
index 00000000000..e5c97d8d9ab
--- /dev/null
+++ b/template/commonCMakeLists.txt
@@ -0,0 +1,167 @@
+#################################################
+#
+# (C) 2013 Alexander Golubev (Fat-Zer)
+# fatzer2 (AT) gmail.com
+#
+# (C) 2020 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 )
+
+
+##### general package setup #####################
+
+string( REGEX REPLACE ".*-([^-]*)$" "\\1" _lang ${CMAKE_CURRENT_SOURCE_DIR} )
+message( STATUS "Configure for language ${_lang}" )
+
+project( tde-i18n-${_lang} )
+set( VERSION R14.0.10 )
+
+
+##### 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 )
+
+
+##### setup install paths #######################
+
+tde_save_and_set( CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "${_lang}" )
+include( TDESetupPaths )
+tde_setup_paths( )
+
+
+##### user requested modules ####################
+
+option( BUILD_ALL "Build all" OFF )
+option( BUILD_DOC "Build documentation" ${BUILD_ALL} )
+option( BUILD_DATA "Build data" ${BUILD_ALL} )
+option( BUILD_MESSAGES "Build message and GUI translation" ${BUILD_ALL} )
+
+
+###### subdirectories ###########################
+
+# build data files
+if( BUILD_DATA AND
+ EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/data/CMakeLists.txt )
+ add_subdirectory( data )
+endif()
+
+
+# build documentation
+if( BUILD_DOC )
+ # search directories with documentation
+ file( GLOB_RECURSE _doc_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} docs/* )
+ foreach( _doc_file IN LISTS _doc_files )
+ get_filename_component( _doc_dir ${_doc_file} PATH )
+ list( APPEND _doc_dirs ${_doc_dir} )
+ endforeach()
+ if( _doc_dirs )
+
+ # sort and clear the list of directories
+ list( SORT _doc_dirs )
+ list( REMOVE_DUPLICATES _doc_dirs )
+ list( REMOVE_ITEM _doc_dirs "docs/common" )
+
+ # install common files
+ file( GLOB common_docs_INSTALL
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/docs/common
+ docs/common/*
+ )
+ file( GLOB common_docs_LINK
+ RELATIVE ${TDE_HTML_DIR}/en/common/
+ ${TDE_HTML_DIR}/en/common/*
+ )
+ if( common_docs_INSTALL )
+ list( REMOVE_ITEM common_docs_INSTALL CMakeLists.txt Makefile.am )
+ foreach( _file IN LISTS common_docs_INSTALL )
+ list( REMOVE_ITEM common_docs_LINK ${_file} )
+ install(
+ FILES docs/common/${_file}
+ DESTINATION ${HTML_INSTALL_DIR}/${_lang}/common
+ )
+ endforeach( )
+ endif()
+ foreach( _file IN LISTS common_docs_LINK )
+ tde_install_symlink(
+ ${TDE_HTML_DIR}/en/common/${_file}
+ ${HTML_INSTALL_DIR}/${_lang}/common/${_file}
+ )
+ endforeach( )
+
+ # create handbooks or install other files
+ foreach( _doc_dir IN LISTS _doc_dirs )
+ file( GLOB _doc_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${_doc_dir} ${_doc_dir}/*.docbook )
+ string( REGEX REPLACE "^[^/]*/[^/]*/" "" _doc_dest ${_doc_dir} )
+ if( _doc_files )
+ list( FIND _doc_files "index.docbook" _find_index )
+ if( -1 EQUAL _find_index )
+ set( _noindex "NOINDEX" )
+ else()
+ unset( _noindex )
+ endif()
+ tde_create_handbook(
+ SOURCE_BASEDIR ${_doc_dir}
+ ${_noindex}
+ LANG ${_lang}
+ DESTINATION ${_doc_dest}
+ )
+ else()
+ file( GLOB _doc_files
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ ${_doc_dir}/*.css ${_doc_dir}/*.png )
+ install(
+ FILES ${_doc_files}
+ DESTINATION ${HTML_INSTALL_DIR}/${_lang}/${_doc_dest}
+ )
+ endif()
+ endforeach()
+ endif()
+endif()
+
+
+# build messages
+if( BUILD_MESSAGES )
+ # install base files for locale
+ file( GLOB locale_base_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ messages/flag.png messages/charset )
+ if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/messages/entry.desktop )
+ tde_create_translated_desktop(
+ SOURCE messages/entry.desktop
+ DESTINATION ${LOCALE_INSTALL_DIR}/${_lang}
+ )
+ endif()
+ if( locale_base_files )
+ install(
+ FILES ${locale_base_files}
+ DESTINATION ${LOCALE_INSTALL_DIR}/${_lang}
+ )
+ endif()
+
+ # create translations
+ file( GLOB_RECURSE _messages RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} messages/*.po )
+ if( _messages )
+ tde_create_translation( FILES ${_messages} LANG ${_lang} )
+ endif()
+endif()
+
+
+# restore default install component name
+
+tde_restore( CMAKE_INSTALL_DEFAULT_COMPONENT_NAME )