diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 68 |
1 files changed, 60 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 084f400..7c6418e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,62 @@ tde_setup_paths( ) option( BUILD_DOC "Build documentation" ON ) option( BUILD_MESSAGES "Build message and GUI translation" ON ) +string( REGEX REPLACE "[ \r\n\t]+" ";" _linguas "$ENV{LINGUAS}" ) + + +###### build documentations for all languages ### + +if( BUILD_DOC ) + file( GLOB_RECURSE _doc_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} */doc/* ) + foreach( _doc_file IN LISTS _doc_files ) + get_filename_component( _dir ${_doc_file} PATH ) + list( APPEND _dirs ${_dir} ) + endforeach() + if( _dirs ) + list( SORT _dirs ) + list( REMOVE_DUPLICATES _dirs ) + endif() + + foreach( _doc_dir IN LISTS _dirs ) + string( REGEX REPLACE "/.*" "" _lang ${_doc_dir} ) + if( NOT ${_lang} MATCHES "^(html|man|misc|other)$" + AND ( ${_lang} STREQUAL "en" OR + "${_linguas}" MATCHES "^;*$" OR + ";${_linguas};" MATCHES ";${_lang};" )) + + file( GLOB _doc_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${_doc_dir} ${_doc_dir}/*.docbook ) + if( ${_doc_dir} MATCHES "^${_lang}/doc/[^/]*/" ) + string( REGEX REPLACE "^${_lang}/doc/(.*)" "\\1" _doc_dest "${_doc_dir}" ) + else() + string( REGEX REPLACE "^${_lang}/doc/(.*)" "\\1" _doc_dest "${_doc_dir}/k3b" ) + endif() + 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}/*.jpg ${_doc_dir}/*.png ) + install( + FILES ${_doc_files} + DESTINATION ${HTML_INSTALL_DIR}/${_lang}/${_doc_dest} + ) + endif() + endif() + endforeach() + +endif() + ###### build translations for all languages ##### @@ -49,13 +105,9 @@ if( BUILD_MESSAGES ) file( GLOB_RECURSE po_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} */messages/*.po ) foreach( _po ${po_files} ) - string( REPLACE "/" ";" _path "${_po}" ) - list( GET _path 0 _lang ) - tde_create_translation( FILES ${_po} LANG ${_lang} ) + string( REGEX REPLACE "/.*" "" _lang ${_po} ) + if( "${_linguas}" MATCHES "^;*$" OR ";${_linguas};" MATCHES ";${_lang};" ) + tde_create_translation( FILES ${_po} LANG ${_lang} ) + endif() endforeach( ) endif( ) - - -###### subdirectories ########################### - -tde_auto_add_subdirectories( ) |