summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/TDEMacros.cmake81
1 files changed, 67 insertions, 14 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index b039f72..a4cd826 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -1656,14 +1656,29 @@ endmacro( tde_add_tdeinit_executable )
#################################################
#####
+##### tde_conditional_add_project_translations
##### tde_add_project_translations
#####
##### Macro for standard processing and installation of translations.
##### This is designed for ordinary modules - as an applications, not for core modules.
+function( tde_conditional_add_project_translations _cond )
+
+ if( ${_cond} )
+ tde_add_project_translations()
+ endif()
+
+endfunction()
+
function( tde_add_project_translations )
- file( GLOB_RECURSE po_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po )
+ if( ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR} )
+ set( TRANSLATIONS_SOURCE_DIR ${PROJECT_SOURCE_DIR}/translations/messages )
+ else()
+ set( TRANSLATIONS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
+ endif()
+
+ file( GLOB_RECURSE po_files RELATIVE ${TRANSLATIONS_SOURCE_DIR} ${TRANSLATIONS_SOURCE_DIR}/*.po )
string( REGEX REPLACE "[ \r\n\t]+" ";" _linguas "$ENV{LINGUAS}" )
foreach( _po ${po_files} )
@@ -1674,7 +1689,7 @@ function( tde_add_project_translations )
else( )
set( _component "${PROJECT_NAME}" )
endif( )
- tde_create_translation( FILES ${_po} LANG ${_lang} OUTPUT_NAME ${_component} )
+ tde_create_translation( FILES ${TRANSLATIONS_SOURCE_DIR}/${_po} LANG ${_lang} OUTPUT_NAME ${_component} )
endif( )
endforeach( )
@@ -2101,14 +2116,29 @@ endmacro( )
#################################################
#####
+##### tde_conditional_add_project_docs
##### tde_add_project_docs
#####
##### Macro for standard processing and installation of documentation and man pages.
##### This is designed for ordinary modules - as an applications, not for core modules.
+function( tde_conditional_add_project_docs _cond )
+
+ if( ${_cond} )
+ tde_add_project_docs()
+ endif()
+
+endfunction()
+
function( tde_add_project_docs )
- file( GLOB_RECURSE _doc_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} * )
+ if( ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR} )
+ set( DOCS_SOURCE_DIR ${PROJECT_SOURCE_DIR}/doc )
+ else()
+ set( DOCS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
+ endif()
+
+ file( GLOB_RECURSE _doc_files RELATIVE ${DOCS_SOURCE_DIR} ${DOCS_SOURCE_DIR}/* )
foreach( _doc_file IN LISTS _doc_files )
get_filename_component( _dir ${_doc_file} PATH )
list( APPEND _dirs ${_dir} )
@@ -2123,15 +2153,15 @@ function( tde_add_project_docs )
unset( _skip_subdir )
foreach( _dir IN LISTS _dirs )
string( REGEX REPLACE "/.*" "" _lang ${_dir} )
- if( NOT ${_lang} MATCHES "^(html|man|misc)$"
+ if( NOT ${_lang} MATCHES "^(html|man|misc|other)$"
AND ( NOT DEFINED _skip_subdir OR
NOT ${_dir} MATCHES "^${_skip_subdir}/" )
AND ( ${_lang} STREQUAL "en" OR
"${_linguas}" MATCHES "^;*$" OR
";${_linguas};" MATCHES ";${_lang};" ))
- if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_dir}/CMakeLists.txt )
+ if( EXISTS ${DOCS_SOURCE_DIR}/${_dir}/CMakeLists.txt )
set( _skip_subdir ${_dir} )
- add_subdirectory( ${_dir} )
+ add_subdirectory( ${DOCS_SOURCE_DIR}/${_dir} )
else()
unset( _skip_subdir )
if( ${_dir} MATCHES "/[^/]*/" )
@@ -2139,7 +2169,7 @@ function( tde_add_project_docs )
else()
string( REGEX REPLACE "^[^/]*/(.*)" "\\1" _doc_dest "${_dir}/${PROJECT_NAME}" )
endif()
- file( GLOB _doc_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${_dir} ${_dir}/*.docbook )
+ file( GLOB _doc_files RELATIVE ${DOCS_SOURCE_DIR}/${_dir} ${DOCS_SOURCE_DIR}/${_dir}/*.docbook )
if( _doc_files )
list( FIND _doc_files "index.docbook" _find_index )
if( -1 EQUAL _find_index )
@@ -2148,19 +2178,32 @@ function( tde_add_project_docs )
unset( _noindex )
endif()
tde_create_handbook(
- SOURCE_BASEDIR ${_dir}
+ SOURCE_BASEDIR ${DOCS_SOURCE_DIR}/${_dir}
${_noindex}
LANG ${_lang}
DESTINATION ${_doc_dest}
)
+ else()
+ file( GLOB _html_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${DOCS_SOURCE_DIR}/${_dir}/*.html )
+ if( _html_files )
+ file( GLOB _htmldoc_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ ${DOCS_SOURCE_DIR}/${_dir}/*.css
+ ${DOCS_SOURCE_DIR}/${_dir}/*.jpg
+ ${DOCS_SOURCE_DIR}/${_dir}/*.png
+ )
+ install(
+ FILES ${_html_files} ${_htmldoc_files}
+ DESTINATION ${HTML_INSTALL_DIR}/${_lang}/${_doc_dest}
+ )
+ endif()
endif()
endif()
endif()
endforeach()
- if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/man AND
- NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/man/CMakeLists.txt )
- file( GLOB_RECURSE _man_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} man/* )
+ if( EXISTS ${DOCS_SOURCE_DIR}/man AND
+ NOT EXISTS ${DOCS_SOURCE_DIR}/man/CMakeLists.txt )
+ file( GLOB_RECURSE _man_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${DOCS_SOURCE_DIR}/man/* )
foreach( _man_file IN LISTS _man_files )
if( ${_man_file} MATCHES "\\.[0-9]$" )
string( REGEX REPLACE ".*\\.([0-9])$" "\\1" _man_section "${_man_file}" )
@@ -2177,9 +2220,19 @@ function( tde_add_project_docs )
endforeach()
endif()
- foreach( _dir html man misc )
- if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_dir}/CMakeLists.txt )
- add_subdirectory( ${_dir} )
+ if( EXISTS ${DOCS_SOURCE_DIR}/misc AND
+ NOT EXISTS ${DOCS_SOURCE_DIR}/misc/CMakeLists.txt )
+ install(
+ DIRECTORY ${DOCS_SOURCE_DIR}/misc/
+ DESTINATION ${SHARE_INSTALL_PREFIX}/doc/${PROJECT_NAME}
+ COMPONENT doc
+ PATTERN Makefile.am EXCLUDE
+ )
+ endif()
+
+ foreach( _dir html man misc other )
+ if( EXISTS ${DOCS_SOURCE_DIR}/${_dir}/CMakeLists.txt )
+ add_subdirectory( ${DOCS_SOURCE_DIR}/${_dir} )
endif()
endforeach()