Warning, /frameworks/kdoctools/src/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 include_directories( ${LIBXML2_INCLUDE_DIR} ${LIBXSLT_INCLUDE_DIR} )
0002 
0003 include(uriencode)
0004 kdoctools_encode_uri(DocBookXML4_DTD_DIR)
0005 set (_custom_dtd_kdex "customization/dtd/kdedbx45.dtd")
0006 configure_file(${_custom_dtd_kdex}.cmake ${CMAKE_CURRENT_BINARY_DIR}/${_custom_dtd_kdex} )
0007 # WARNING: this is due to severe limitations on the windows platform to keep the dtd relocatable
0008 # see the .xsl.cmake files for a more verbose explanation below
0009 if(NOT WIN32)
0010     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_custom_dtd_kdex}
0011         DESTINATION ${KDE_INSTALL_DATADIR_KF}/kdoctools/customization/dtd )
0012 else()
0013     get_filename_component(NORMALIZED_DTD_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/${KDE_INSTALL_DATADIR_KF}/kdoctools/customization/dtd" ABSOLUTE)
0014     # file(RELATIVE_PATH ...) returns wrong values for paths containing /../ (it doesn't normalize the path)
0015     # To work around this we make sure the variable passed has all /../ elements
0016     # removed using get_filename_component(... ABSOLUTE)
0017     install(CODE
0018         "file(RELATIVE_PATH DocBookXML4_DTD_DIR \"${NORMALIZED_DTD_INSTALL_PATH}\" \"${DocBookXML4_DTD_DIR}\")
0019         set(PERL_EXECUTABLE \"${PERL_EXECUTABLE}\")
0020         include(\"${CMAKE_SOURCE_DIR}/cmake/uriencode.cmake\")
0021         set(CMAKE_MODULE_PATH \"${CMAKE_MODULE_PATH}\")
0022         kdoctools_encode_uri(DocBookXML4_DTD_DIR)
0023         configure_file(\"${CMAKE_CURRENT_SOURCE_DIR}/${_custom_dtd_kdex}.cmake\" \"${CMAKE_CURRENT_BINARY_DIR}/${_custom_dtd_kdex}.install\")"
0024     )
0025     get_filename_component(_custom_dtd_kdex_name ${_custom_dtd_kdex} NAME)
0026     install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${_custom_dtd_kdex}.install" DESTINATION ${KDE_INSTALL_DATADIR_KF}/kdoctools/customization/dtd RENAME ${_custom_dtd_kdex_name})
0027 endif()
0028 
0029 ecm_qt_declare_logging_category(kdoctoolslog_core_SRCS
0030     HEADER loggingcategory.h
0031     IDENTIFIER KDocToolsLog
0032     CATEGORY_NAME kf.doctools.core
0033     DEFAULT_SEVERITY Warning
0034 )
0035 
0036 # needed by KIO, need to export it
0037 add_library(KF6DocTools SHARED xslt.cpp xslt_kde.cpp ${kdoctoolslog_core_SRCS})
0038 add_library(KF6::DocTools ALIAS KF6DocTools)
0039 
0040 set_target_properties(KF6DocTools PROPERTIES
0041     VERSION     ${KDOCTOOLS_VERSION}
0042     SOVERSION   ${KDOCTOOLS_SOVERSION}
0043     EXPORT_NAME DocTools
0044     POSITION_INDEPENDENT_CODE TRUE
0045 )
0046 
0047 ecm_generate_export_header(KF6DocTools
0048     BASE_NAME KDocTools
0049     EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/kdoctools_export.h"
0050     GROUP_BASE_NAME KF
0051     VERSION ${KF_VERSION}
0052     USE_VERSION_HEADER
0053     DEPRECATED_BASE_VERSION 0
0054 )
0055 
0056 if (NOT MEINPROC_NO_KARCHIVE)
0057     set (_private_link_karchive "KF6::Archive")
0058 else()
0059     set (_private_link_karchive "")
0060 endif()
0061 
0062 target_link_libraries(KF6DocTools
0063     PUBLIC
0064         Qt6::Core
0065     PRIVATE
0066         ${LIBXML2_LIBRARIES}
0067         ${LIBXSLT_LIBRARIES}
0068         ${LIBXSLT_EXSLT_LIBRARIES}
0069         ${_private_link_karchive}
0070 )
0071 
0072 target_include_directories(KF6DocTools INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF}/KDocTools>")
0073 
0074 set(KDocTools_HEADERS
0075     docbookxslt.h
0076 )
0077 
0078 install(FILES
0079     ${KDocTools_HEADERS}
0080     ${CMAKE_CURRENT_BINARY_DIR}/kdoctools_export.h
0081     DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/KDocTools
0082     COMPONENT Devel
0083 )
0084 
0085 install(TARGETS KF6DocTools EXPORT KF6DocToolsTargets ${KF_INSTALL_TARGETS_DEFAULT_ARGS})
0086 
0087 if(BUILD_QCH)
0088     ecm_add_qch(
0089         KF6DocTools_QCH
0090         NAME KDocTools
0091         BASE_NAME KF6DocTools
0092         VERSION ${KF_VERSION}
0093         ORG_DOMAIN org.kde
0094         SOURCES # using only public headers, to cover only public API
0095             ${KDocTools_HEADERS}
0096         MD_MAINPAGE "${CMAKE_SOURCE_DIR}/README.md"
0097         LINK_QCHS
0098             Qt6Core_QCH
0099         INCLUDE_DIRS
0100             ${CMAKE_CURRENT_BINARY_DIR}
0101         BLANK_MACROS
0102             KDOCTOOLS_EXPORT
0103         TAGFILE_INSTALL_DESTINATION ${KDE_INSTALL_QTQCHDIR}
0104         QCH_INSTALL_DESTINATION ${KDE_INSTALL_QTQCHDIR}
0105         COMPONENT Devel
0106     )
0107 endif()
0108 
0109 ########### next target ###############
0110 
0111 set_source_files_properties(xslt.cpp PROPERTIES COMPILE_FLAGS -DSIMPLE_XSLT )
0112 
0113 if(MEINPROC_NO_KARCHIVE)
0114     add_definitions(-DMEINPROC_NO_KARCHIVE) #we don't have saveToCache when compiling without KArchive, which is used in xslt_kde.cpp
0115 else ()
0116     set(meinproc_additional_SRCS xslt_kde.cpp)
0117     set(meinproc_additional_LIBS KF6::Archive)
0118 endif()
0119 
0120 add_executable(meinproc6 meinproc.cpp meinproc_common.cpp xslt.cpp ${meinproc_additional_SRCS} ${kdoctoolslog_core_SRCS})
0121 ecm_mark_nongui_executable(meinproc6)
0122 target_link_libraries(meinproc6
0123     PRIVATE
0124         Qt6::Core
0125         ${LIBXML2_LIBRARIES}
0126         ${LIBXSLT_LIBRARIES}
0127         ${LIBXSLT_EXSLT_LIBRARIES}
0128         ${meinproc_additional_LIBS}
0129 )
0130 
0131 target_compile_definitions(meinproc6 PRIVATE -DKDOCTOOLS_EXPORT=)
0132 install(TARGETS meinproc6 EXPORT KF6DocToolsToolsTargets ${KF_INSTALL_TARGETS_DEFAULT_ARGS})
0133 
0134 if(CMAKE_CROSSCOMPILING AND MEINPROC6_EXECUTABLE)
0135     add_executable(KF6::meinproc6 IMPORTED GLOBAL)
0136     set_target_properties(KF6::meinproc6 PROPERTIES IMPORTED_LOCATION ${MEINPROC6_EXECUTABLE})
0137 else()
0138     add_executable(KF6::meinproc6 ALIAS meinproc6)
0139 endif()
0140 
0141 ########### customize includes for xslt ###############
0142 # WARNING: this has severe limitations on the windows platform since the .xsl
0143 # & docbook files need to be relocatable. We cannot just replace the paths in
0144 # the .xsl with relative paths because these files are not installed while
0145 # building kdoctools. Instead, we will reconfigure those files at install time
0146 # with relative paths.
0147 
0148 file( GLOB _kdeincludexslt_ALL "customization/kde-include*.xsl.cmake" )
0149 foreach( _kdeincludexslt ${_kdeincludexslt_ALL} )
0150     get_filename_component( _kdeincludexslt_name ${_kdeincludexslt} NAME )
0151     string( REGEX REPLACE ".cmake$" "" _kdeincludexslt_out "${_kdeincludexslt_name}" )
0152     set( _kdeincludexslt_binarypath "${CMAKE_CURRENT_BINARY_DIR}/customization/${_kdeincludexslt_out}" )
0153     configure_file( ${_kdeincludexslt} ${_kdeincludexslt_binarypath} )
0154     if(NOT WIN32)
0155         install(FILES ${_kdeincludexslt_binarypath}
0156             DESTINATION ${KDE_INSTALL_DATADIR_KF}/kdoctools/customization )
0157     else()
0158         install(CODE
0159             "FILE(RELATIVE_PATH DOCBOOKXSL_DIR \${CMAKE_INSTALL_PREFIX}/${KDE_INSTALL_DATADIR_KF}/kdoctools/customization ${DOCBOOKXSL_DIR})
0160             CONFIGURE_FILE( \"${_kdeincludexslt}\" \"${_kdeincludexslt_binarypath}.install\" )")
0161             install(FILES "${_kdeincludexslt_binarypath}.install" DESTINATION ${KDE_INSTALL_DATADIR_KF}/kdoctools/customization RENAME ${_kdeincludexslt_out})
0162     endif()
0163 endforeach( _kdeincludexslt ${_kdeincludexslt_ALL} )
0164 
0165 
0166 ########### install files ###############
0167 
0168 macro(INSTALL_CUSTOMIZE_DIR _expr _directory)
0169     FILE(GLOB _file_CUST "${_expr}" )
0170     foreach(_curentfile ${_file_CUST})
0171         install(FILES ${_curentfile} DESTINATION ${KDE_INSTALL_DATADIR_KF}/kdoctools/${_directory} )
0172     endforeach(_curentfile ${_file_CUST})
0173 endmacro(INSTALL_CUSTOMIZE_DIR _expr _directory)
0174 
0175 macro(INSTALL_CUSTOMIZE_L_DIR _expr _directory)
0176     FILE(GLOB _file_CUST "${_expr}" )
0177     foreach(_curentfile ${_file_CUST})
0178         # copy the file also under CMAKE_CURRENT_BINARY_DIR - those
0179         # files are needed to generate the documentation without installing
0180         # kdoctools (i.e. when kdoctools itself compiled).
0181         get_filename_component(_currentfile_name ${_curentfile} NAME)
0182         set(_currentfile_binary_path ${CMAKE_CURRENT_BINARY_DIR}/${_directory}/${_currentfile_name})
0183         configure_file(${_curentfile} ${_currentfile_binary_path} COPYONLY)
0184 
0185         install(FILES ${_currentfile_binary_path}
0186             DESTINATION ${KDE_INSTALL_DATADIR_KF}/kdoctools/${_directory} )
0187     endforeach(_curentfile ${_file_CUST})
0188 endmacro(INSTALL_CUSTOMIZE_L_DIR _expr _directory)
0189 
0190 
0191 
0192 set(expr "customization/*.xsl")
0193 install_customize_l_dir( ${expr} customization/)
0194 
0195 set(expr "customization/README")
0196 install_customize_l_dir( ${expr} customization/)
0197 
0198 set(expr "customization/catalog.xml")
0199 install_customize_l_dir( ${expr} customization/)
0200 
0201 set(customizedir ${KDOCTOOLS_LANGUAGES_LIST} dtd entities xsl)
0202 
0203 foreach (_currentcustomizedir ${customizedir})
0204     set(expr "customization/${_currentcustomizedir}/README")
0205     install_customize_l_dir( ${expr} customization/${_currentcustomizedir})
0206     set(expr "customization/${_currentcustomizedir}/*.entities")
0207     install_customize_l_dir( ${expr} customization/${_currentcustomizedir})
0208     set(expr "customization/${_currentcustomizedir}/*.xsl")
0209     install_customize_l_dir( ${expr} customization/${_currentcustomizedir})
0210     set(expr "customization/${_currentcustomizedir}/entities/*.docbook")
0211     install_customize_l_dir( ${expr} customization/${_currentcustomizedir}/entities/ )
0212     set(expr "customization/${_currentcustomizedir}/entities/*.entities")
0213     install_customize_l_dir( ${expr} customization/${_currentcustomizedir}/entities/ )
0214     set(expr "customization/${_currentcustomizedir}/*.xml")
0215     install_customize_l_dir(${expr} customization/${_currentcustomizedir} )
0216     set(expr "customization/${_currentcustomizedir}/*.dtd")
0217     install_customize_l_dir(${expr} customization/${_currentcustomizedir}/)
0218     set(expr "customization/${_currentcustomizedir}/*.elements")
0219     install_customize_l_dir(${expr} customization/${_currentcustomizedir}/)
0220 endforeach(_currentcustomizedir ${customizedir})
0221 
0222 ########### l10n xml helper ###############
0223 
0224 set( docbookl10nhelper_SRCS docbookl10nhelper.cpp ${kdoctoolslog_core_SRCS})
0225 add_executable( docbookl10nhelper ${docbookl10nhelper_SRCS} )
0226 ecm_mark_nongui_executable( docbookl10nhelper )
0227 target_link_libraries( docbookl10nhelper Qt6::Core )
0228 if(INSTALL_INTERNAL_TOOLS)
0229     install(TARGETS docbookl10nhelper EXPORT KF6DocToolsToolsTargets ${KF_INSTALL_TARGETS_DEFAULT_ARGS})
0230 endif()
0231 
0232 if(CMAKE_CROSSCOMPILING AND DOCBOOKL10NHELPER_EXECUTABLE)
0233     add_executable(KF6::docbookl10nhelper IMPORTED GLOBAL)
0234     set_target_properties(KF6::docbookl10nhelper PROPERTIES IMPORTED_LOCATION ${DOCBOOKL10NHELPER_EXECUTABLE})
0235 else()
0236     add_executable(KF6::docbookl10nhelper ALIAS docbookl10nhelper)
0237 endif()
0238 
0239 add_custom_command( TARGET docbookl10nhelper POST_BUILD
0240     COMMAND $<TARGET_FILE:KF6::docbookl10nhelper>
0241     "${DOCBOOKXSL_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/customization/xsl"
0242     "${CMAKE_CURRENT_BINARY_DIR}/customization/xsl"
0243 )
0244 
0245 # all-l10n.xml is generated by docbookl10nhelper
0246 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/customization/xsl/all-l10n.xml
0247     DESTINATION ${KDE_INSTALL_DATADIR_KF}/kdoctools/customization/xsl/ )
0248 
0249 ########### checkXML6 helper ###############
0250 
0251 set( checkXML6_SRCS checkXML6.cpp ${kdoctoolslog_core_SRCS})
0252 add_executable( checkXML6 ${checkXML6_SRCS} )
0253 ecm_mark_nongui_executable( checkXML6 )
0254 target_link_libraries( checkXML6 Qt6::Core )
0255 install(TARGETS checkXML6 EXPORT KF6DocToolsToolsTargets ${KF_INSTALL_TARGETS_DEFAULT_ARGS})
0256 
0257 if(CMAKE_CROSSCOMPILING AND CHECKXML6_EXECUTABLE)
0258     add_executable(KF6::checkXML6 IMPORTED GLOBAL)
0259     set_target_properties(KF6::checkXML6 PROPERTIES IMPORTED_LOCATION ${CHECKXML6_EXECUTABLE})
0260 else()
0261     add_executable(KF6::checkXML6 ALIAS checkXML6)
0262 endif()