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(KF5DocTools SHARED xslt.cpp xslt_kde.cpp ${kdoctoolslog_core_SRCS})
0038 generate_export_header(KF5DocTools BASE_NAME KDocTools EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/kdoctools_export.h")
0039 add_library(KF5::DocTools ALIAS KF5DocTools)
0040 if (NOT MEINPROC_NO_KARCHIVE)
0041     set (_private_link_karchive "KF5::Archive")
0042 else()
0043     set (_private_link_karchive "")
0044 endif()
0045 
0046 target_link_libraries(KF5DocTools
0047     PUBLIC
0048         Qt${QT_MAJOR_VERSION}::Core
0049     PRIVATE
0050         ${LIBXML2_LIBRARIES}
0051         ${LIBXSLT_LIBRARIES}
0052         ${LIBXSLT_EXSLT_LIBRARIES}
0053         ${_private_link_karchive}
0054 )
0055 
0056 set_target_properties(KF5DocTools PROPERTIES
0057     POSITION_INDEPENDENT_CODE TRUE
0058     EXPORT_NAME KDocTools
0059 )
0060 
0061 target_include_directories(KF5DocTools INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF}/KDocTools>")
0062 
0063 set(KDocTools_HEADERS
0064     docbookxslt.h
0065 )
0066 
0067 install(FILES
0068     ${KDocTools_HEADERS}
0069     ${CMAKE_CURRENT_BINARY_DIR}/kdoctools_export.h
0070     DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/KDocTools
0071     COMPONENT Devel
0072 )
0073 
0074 set_target_properties(KF5DocTools PROPERTIES VERSION   ${KDOCTOOLS_VERSION}
0075                                              SOVERSION ${KDOCTOOLS_SOVERSION}
0076                                              EXPORT_NAME DocTools
0077 )
0078 
0079 install(TARGETS KF5DocTools EXPORT KF5DocToolsTargets ${KF_INSTALL_TARGETS_DEFAULT_ARGS})
0080 
0081 if(BUILD_QCH)
0082     ecm_add_qch(
0083         KF5DocTools_QCH
0084         NAME KDocTools
0085         BASE_NAME KF5DocTools
0086         VERSION ${KF_VERSION}
0087         ORG_DOMAIN org.kde
0088         SOURCES # using only public headers, to cover only public API
0089             ${KDocTools_HEADERS}
0090         MD_MAINPAGE "${CMAKE_SOURCE_DIR}/README.md"
0091         LINK_QCHS
0092             Qt5Core_QCH
0093         INCLUDE_DIRS
0094             ${CMAKE_CURRENT_BINARY_DIR}
0095         BLANK_MACROS
0096             KDOCTOOLS_EXPORT
0097         TAGFILE_INSTALL_DESTINATION ${KDE_INSTALL_QTQCHDIR}
0098         QCH_INSTALL_DESTINATION ${KDE_INSTALL_QTQCHDIR}
0099         COMPONENT Devel
0100     )
0101 endif()
0102 
0103 ########### next target ###############
0104 
0105 set_source_files_properties(xslt.cpp PROPERTIES COMPILE_FLAGS -DSIMPLE_XSLT )
0106 
0107 if(MEINPROC_NO_KARCHIVE)
0108     add_definitions(-DMEINPROC_NO_KARCHIVE) #we don't have saveToCache when compiling without KArchive, which is used in xslt_kde.cpp
0109 else ()
0110     set(meinproc_additional_SRCS xslt_kde.cpp)
0111     set(meinproc_additional_LIBS KF5::Archive)
0112 endif()
0113 
0114 add_executable(meinproc5 meinproc.cpp meinproc_common.cpp xslt.cpp ${meinproc_additional_SRCS} ${kdoctoolslog_core_SRCS})
0115 ecm_mark_nongui_executable(meinproc5)
0116 target_link_libraries(meinproc5
0117     PRIVATE
0118         Qt${QT_MAJOR_VERSION}::Core
0119         ${LIBXML2_LIBRARIES}
0120         ${LIBXSLT_LIBRARIES}
0121         ${LIBXSLT_EXSLT_LIBRARIES}
0122         ${meinproc_additional_LIBS}
0123         ${_qt5_compat_lib}
0124 )
0125 
0126 target_compile_definitions(meinproc5 PRIVATE -DKDOCTOOLS_EXPORT=)
0127 install(TARGETS meinproc5 EXPORT KF5DocToolsToolsTargets ${KF_INSTALL_TARGETS_DEFAULT_ARGS})
0128 
0129 if(CMAKE_CROSSCOMPILING AND MEINPROC5_EXECUTABLE)
0130     add_executable(KF5::meinproc5 IMPORTED GLOBAL)
0131     set_target_properties(KF5::meinproc5 PROPERTIES IMPORTED_LOCATION ${MEINPROC5_EXECUTABLE})
0132 else()
0133     add_executable(KF5::meinproc5 ALIAS meinproc5)
0134 endif()
0135 
0136 ########### customize includes for xslt ###############
0137 # WARNING: this has severe limitations on the windows platform since the .xsl
0138 # & docbook files need to be relocatable. We cannot just replace the paths in
0139 # the .xsl with relative paths because these files are not installed while
0140 # building kdoctools. Instead, we will reconfigure those files at install time
0141 # with relative paths.
0142 
0143 file( GLOB _kdeincludexslt_ALL "customization/kde-include*.xsl.cmake" )
0144 foreach( _kdeincludexslt ${_kdeincludexslt_ALL} )
0145     get_filename_component( _kdeincludexslt_name ${_kdeincludexslt} NAME )
0146     string( REGEX REPLACE ".cmake$" "" _kdeincludexslt_out "${_kdeincludexslt_name}" )
0147     set( _kdeincludexslt_binarypath "${CMAKE_CURRENT_BINARY_DIR}/customization/${_kdeincludexslt_out}" )
0148     configure_file( ${_kdeincludexslt} ${_kdeincludexslt_binarypath} )
0149     if(NOT WIN32)
0150         install(FILES ${_kdeincludexslt_binarypath}
0151             DESTINATION ${KDE_INSTALL_DATADIR_KF}/kdoctools/customization )
0152     else()
0153         install(CODE
0154             "FILE(RELATIVE_PATH DOCBOOKXSL_DIR \${CMAKE_INSTALL_PREFIX}/${KDE_INSTALL_DATADIR_KF}/kdoctools/customization ${DOCBOOKXSL_DIR})
0155             CONFIGURE_FILE( \"${_kdeincludexslt}\" \"${_kdeincludexslt_binarypath}.install\" )")
0156             install(FILES "${_kdeincludexslt_binarypath}.install" DESTINATION ${KDE_INSTALL_DATADIR_KF}/kdoctools/customization RENAME ${_kdeincludexslt_out})
0157     endif()
0158 endforeach( _kdeincludexslt ${_kdeincludexslt_ALL} )
0159 
0160 
0161 ########### install files ###############
0162 
0163 macro(INSTALL_CUSTOMIZE_DIR _expr _directory)
0164     FILE(GLOB _file_CUST "${_expr}" )
0165     foreach(_curentfile ${_file_CUST})
0166         install(FILES ${_curentfile} DESTINATION ${KDE_INSTALL_DATADIR_KF}/kdoctools/${_directory} )
0167     endforeach(_curentfile ${_file_CUST})
0168 endmacro(INSTALL_CUSTOMIZE_DIR _expr _directory)
0169 
0170 macro(INSTALL_CUSTOMIZE_L_DIR _expr _directory)
0171     FILE(GLOB _file_CUST "${_expr}" )
0172     foreach(_curentfile ${_file_CUST})
0173         # copy the file also under CMAKE_CURRENT_BINARY_DIR - those
0174         # files are needed to generate the documentation without installing
0175         # kdoctools (i.e. when kdoctools itself compiled).
0176         get_filename_component(_currentfile_name ${_curentfile} NAME)
0177         set(_currentfile_binary_path ${CMAKE_CURRENT_BINARY_DIR}/${_directory}/${_currentfile_name})
0178         configure_file(${_curentfile} ${_currentfile_binary_path} COPYONLY)
0179 
0180         install(FILES ${_currentfile_binary_path}
0181             DESTINATION ${KDE_INSTALL_DATADIR_KF}/kdoctools/${_directory} )
0182     endforeach(_curentfile ${_file_CUST})
0183 endmacro(INSTALL_CUSTOMIZE_L_DIR _expr _directory)
0184 
0185 
0186 
0187 set(expr "customization/*.xsl")
0188 install_customize_l_dir( ${expr} customization/)
0189 
0190 set(expr "customization/README")
0191 install_customize_l_dir( ${expr} customization/)
0192 
0193 set(expr "customization/catalog.xml")
0194 install_customize_l_dir( ${expr} customization/)
0195 
0196 set(customizedir ${KDOCTOOLS_LANGUAGES_LIST} dtd entities xsl)
0197 
0198 foreach (_currentcustomizedir ${customizedir})
0199     set(expr "customization/${_currentcustomizedir}/README")
0200     install_customize_l_dir( ${expr} customization/${_currentcustomizedir})
0201     set(expr "customization/${_currentcustomizedir}/*.entities")
0202     install_customize_l_dir( ${expr} customization/${_currentcustomizedir})
0203     set(expr "customization/${_currentcustomizedir}/*.xsl")
0204     install_customize_l_dir( ${expr} customization/${_currentcustomizedir})
0205     set(expr "customization/${_currentcustomizedir}/entities/*.docbook")
0206     install_customize_l_dir( ${expr} customization/${_currentcustomizedir}/entities/ )
0207     set(expr "customization/${_currentcustomizedir}/entities/*.entities")
0208     install_customize_l_dir( ${expr} customization/${_currentcustomizedir}/entities/ )
0209     set(expr "customization/${_currentcustomizedir}/*.xml")
0210     install_customize_l_dir(${expr} customization/${_currentcustomizedir} )
0211     set(expr "customization/${_currentcustomizedir}/*.dtd")
0212     install_customize_l_dir(${expr} customization/${_currentcustomizedir}/)
0213     set(expr "customization/${_currentcustomizedir}/*.elements")
0214     install_customize_l_dir(${expr} customization/${_currentcustomizedir}/)
0215 endforeach(_currentcustomizedir ${customizedir})
0216 
0217 ########### l10n xml helper ###############
0218 
0219 set( docbookl10nhelper_SRCS docbookl10nhelper.cpp ${kdoctoolslog_core_SRCS})
0220 add_executable( docbookl10nhelper ${docbookl10nhelper_SRCS} )
0221 ecm_mark_nongui_executable( docbookl10nhelper )
0222 target_link_libraries( docbookl10nhelper Qt${QT_MAJOR_VERSION}::Core )
0223 if(INSTALL_INTERNAL_TOOLS)
0224     install(TARGETS docbookl10nhelper EXPORT KF5DocToolsToolsTargets ${KF_INSTALL_TARGETS_DEFAULT_ARGS})
0225 endif()
0226 
0227 if(CMAKE_CROSSCOMPILING AND DOCBOOKL10NHELPER_EXECUTABLE)
0228     add_executable(KF5::docbookl10nhelper IMPORTED GLOBAL)
0229     set_target_properties(KF5::docbookl10nhelper PROPERTIES IMPORTED_LOCATION ${DOCBOOKL10NHELPER_EXECUTABLE})
0230 else()
0231     add_executable(KF5::docbookl10nhelper ALIAS docbookl10nhelper)
0232 endif()
0233 
0234 add_custom_command( TARGET docbookl10nhelper POST_BUILD
0235     COMMAND $<TARGET_FILE:KF5::docbookl10nhelper>
0236     "${DOCBOOKXSL_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/customization/xsl"
0237     "${CMAKE_CURRENT_BINARY_DIR}/customization/xsl"
0238 )
0239 
0240 # all-l10n.xml is generated by docbookl10nhelper
0241 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/customization/xsl/all-l10n.xml
0242     DESTINATION ${KDE_INSTALL_DATADIR_KF}/kdoctools/customization/xsl/ )
0243 
0244 ########### checkxml5 helper ###############
0245 
0246 set( checkXML5_SRCS checkXML5.cpp ${kdoctoolslog_core_SRCS})
0247 add_executable( checkXML5 ${checkXML5_SRCS} )
0248 ecm_mark_nongui_executable( checkXML5 )
0249 target_link_libraries( checkXML5 Qt${QT_MAJOR_VERSION}::Core )
0250 install(TARGETS checkXML5 EXPORT KF5DocToolsToolsTargets ${KF_INSTALL_TARGETS_DEFAULT_ARGS})
0251 
0252 if(CMAKE_CROSSCOMPILING AND CHECKXML5_EXECUTABLE)
0253     add_executable(KF5::checkXML5 IMPORTED GLOBAL)
0254     set_target_properties(KF5::checkXML5 PROPERTIES IMPORTED_LOCATION ${CHECKXML5_EXECUTABLE})
0255 else()
0256     add_executable(KF5::checkXML5 ALIAS checkXML5)
0257 endif()