Add:Build:Optionally use xsltproc for xslt processing
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sun, 4 Sep 2011 22:24:27 +0000 (22:24 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sun, 4 Sep 2011 22:24:27 +0000 (22:24 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4759 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/CMakeLists.txt
navit/navit/CMakeLists.txt

index bb433cf..2e497cf 100644 (file)
@@ -353,16 +353,16 @@ add_feature(DBUS_USE_SYSTEM_BUS "default" FALSE)
 add_feature(BUILD_MAPTOOL "default" TRUE)
 add_feature(XSL_PROCESSING "default" TRUE)
 
-find_program(SAXON NAMES saxon saxon8 saxon-xslt saxonb-xslt)
-if(SAXON)
-   execute_process(COMMAND ${SAXON} -snone ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test.xml ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test.xslt
+find_program(XSLT_PROCESSOR NAMES saxon saxon8 saxon-xslt saxonb-xslt xsltproc)
+if(XSLT_PROCESSOR)
+   execute_process(COMMAND ${XSLT_PROCESSOR} -snone ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test.xml ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test.xslt
       RESULT_VARIABLE SAXON_ERROR ERROR_QUIET)
    if (NOT SAXON_ERROR)
-      set (SAXON_OPTIONS -snone)
+      set (XSLT_PROCESSOR_OPTIONS -snone)
    endif()
 else()
    cfg_feature(XSL_PROCESSING "Saxon missing" FALSE)
-endif(SAXON)
+endif(XSLT_PROCESSOR)
 
 if (NOT XSL_PROCESSING)
    message(WARNING "XSLT processing disabled. You have to configure navit.xml yourself, or enable XSLT processing.")
index 7358921..3c84970 100644 (file)
@@ -112,7 +112,11 @@ macro(process_xslt SRC_XML DEST_XML XSL_OPTIONS)
           set (XSLT_FILE "${PROJECT_SOURCE_DIR}/navit/xslt/${tmp}.xslt")
           list(APPEND XSLT_FILES "${XSLT_FILE}")
           list(APPEND XSLT_COMMANDS COMMAND ${CMAKE_COMMAND} -E echo  Applying ${tmp}.xslt)
-          list(APPEND XSLT_COMMANDS COMMAND ${SAXON} ${SAXON_OPTIONS} ${DEST_XML} ${XSLT_FILE} ${XSL_OPTIONS} > ${DEST_XML}.tmp)
+         if(${XSLT_PROCESSOR} MATCHES "xsltproc")
+             list(APPEND XSLT_COMMANDS COMMAND ${XSLT_PROCESSOR} ${XSLT_PROCESSOR_OPTIONS} ${XSLT_FILE} ${DEST_XML} > ${DEST_XML}.tmp)
+          else()
+             list(APPEND XSLT_COMMANDS COMMAND ${XSLT_PROCESSOR} ${XSLT_PROCESSOR_OPTIONS} ${DEST_XML} ${XSLT_FILE} ${XSL_OPTIONS} > ${DEST_XML}.tmp)
+         endif()
           list(APPEND XSLT_COMMANDS COMMAND ${CMAKE_COMMAND} -E rename ${DEST_XML}.tmp ${DEST_XML})
        endforeach()
    endif()