Warning, /pim/akonadi/cmake/modules/AkonadiMacros.cmake is written in an unsupported language. File is not indexed.
0001 # SPDX-License-Identifier: BSD-3-Clause 0002 0003 # Internal server macros 0004 function(akonadi_run_xsltproc) 0005 if (NOT XSLTPROC_EXECUTABLE) 0006 message(FATAL_ERROR "xsltproc executable not found but needed by AKONADI_RUN_XSLTPROC()") 0007 endif() 0008 0009 set(options ) 0010 set(oneValueArgs XSL XML CLASSNAME BASENAME) 0011 set(multiValueArgs DEPENDS) 0012 cmake_parse_arguments(XSLT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) 0013 if (NOT XSLT_XSL) 0014 message(FATAL_ERROR "Required argument XSL missing in AKONADI_RUN_XSLTPROC() call") 0015 endif() 0016 if (NOT XSLT_XML) 0017 message(FATAL_ERROR "Required argument XML missing in AKONADI_RUN_XSLTPROC() call") 0018 endif() 0019 if (NOT XSLT_BASENAME) 0020 message(FATAL_ERROR "Required argument BASENAME missing in AKONADI_RUN_XSLTPROC() call") 0021 endif() 0022 0023 # Workaround xsltproc struggling with spaces in filepaths on Windows 0024 file(RELATIVE_PATH xsl_relpath ${CMAKE_CURRENT_BINARY_DIR} ${XSLT_XSL}) 0025 file(RELATIVE_PATH xml_relpath ${CMAKE_CURRENT_BINARY_DIR} ${XSLT_XML}) 0026 0027 set(extra_params ) 0028 if (XSLT_CLASSNAME) 0029 set(extra_params --stringparam className ${XSLT_CLASSNAME}) 0030 endif() 0031 0032 add_custom_command( 0033 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${XSLT_BASENAME}.h 0034 ${CMAKE_CURRENT_BINARY_DIR}/${XSLT_BASENAME}.cpp 0035 COMMAND ${XSLTPROC_EXECUTABLE} 0036 --output ${XSLT_BASENAME}.h 0037 --stringparam code header 0038 --stringparam fileName ${XSLT_BASENAME} 0039 ${extra_params} 0040 ${xsl_relpath} 0041 ${xml_relpath} 0042 COMMAND ${XSLTPROC_EXECUTABLE} 0043 --output ${XSLT_BASENAME}.cpp 0044 --stringparam code source 0045 --stringparam fileName ${XSLT_BASENAME} 0046 ${extra_params} 0047 ${xsl_relpath} 0048 ${xml_relpath} 0049 DEPENDS ${XSLT_XSL} 0050 ${XSLT_XML} 0051 ${XSLT_DEPENDS} 0052 ) 0053 0054 set_property(SOURCE 0055 ${CMAKE_CURRENT_BINARY_DIR}/${XSLT_BASENAME}.cpp 0056 ${CMAKE_CURRENT_BINARY_DIR}/${XSLT_BASENAME}.h 0057 PROPERTY SKIP_AUTOMOC TRUE 0058 ) 0059 endfunction() 0060 0061 macro(akonadi_generate_schema _schemaXml _className _fileBaseName) 0062 if (NOT XSLTPROC_EXECUTABLE) 0063 message(FATAL_ERROR "xsltproc executable not found but needed by AKONADI_GENERATE_SCHEMA()") 0064 endif() 0065 0066 akonadi_run_xsltproc( 0067 XSL ${Akonadi_SOURCE_DIR}/src/server/storage/schema.xsl 0068 XML ${_schemaXml} 0069 CLASSNAME ${_className} 0070 BASENAME ${_fileBaseName} 0071 ) 0072 endmacro() 0073 0074 function(akonadi_add_xmllint_test) 0075 if (NOT XMLLINT_EXECUTABLE) 0076 message(FATAL_ERROR "xmllint executable not found but needed by AKONADI_ADD_XMLLINT_SCHEMA()") 0077 endif() 0078 0079 set(options ) 0080 set(oneValueArgs XML XSD) 0081 set(multiValueArgs ) 0082 cmake_parse_arguments(TEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) 0083 0084 file(RELATIVE_PATH xsd_relpath ${CMAKE_CURRENT_BINARY_DIR} ${TEST_XSD}) 0085 file(RELATIVE_PATH xml_relpath ${CMAKE_CURRENT_BINARY_DIR} ${TEST_XML}) 0086 add_test(${TEST_UNPARSED_ARGUMENTS} ${XMLLINT_EXECUTABLE} --noout --schema ${xsd_relpath} ${xml_relpath}) 0087 endfunction() 0088