find_package(Perl)
+if(PERL_FOUND)
+ set(DVI_FORMATS "dvi" "dvi3")
+ set(PDF_FORMATS "pdf" "pdf2" "pdf3" "pdf4" "pdf5")
+else()
+ set(DVI_FORMATS "dvi")
+ set(PDF_FORMATS "pdf" "pdf2" "pdf3")
+endif()
+
macro(getoutputformats filepath varname)
file(STRINGS "${filepath}" lines)
- set(out_formats "xhtml" "dvi" "dvi3" "pdf" "pdf2" "pdf3" "pdf4" "pdf5")
- if(NOT PERL_FOUND)
- list(REMOVE_ITEM out_formats "dvi3" "pdf4" "pdf5")
- endif()
- set(${varname} ${out_formats})
+ # What should we test, if default_output_format is not defined?
+ # For now we test everything ...
+ set(out_formats "xhtml" ${DVI_FORMATS} ${PDF_FORMATS})
foreach(_l ${lines})
if(_l MATCHES "^\\\\default_output_format +\([^ ]+\)")
- if(CMAKE_MATCH_1 STREQUAL "default")
- set(found ${out_formats})
- elseif(CMAKE_MATCH_1 STREQUAL "pdf2")
- set(found "pdf2" "pdf4" "pdf5")
- elseif(CMAKE_MATCH_1 STREQUAL "xhtml")
- set(found "xhtml")
+ set(_format ${CMAKE_MATCH_1})
+ if(_format STREQUAL "default")
+ set(out_formats "xhtml" ${DVI_FORMATS} ${PDF_FORMATS})
+ elseif(_format MATCHES "pdf")
+ set(found "xhtml" ${PDF_FORMATS})
+ elseif(_format MATCHES "dvi")
+ set(out_formats "xhtml" ${DVI_FORMATS})
else()
- set(found "xhtml" ${CMAKE_MATCH_1})
+ # Respect all other output formats
+ # like "eps3", "xhtml"
+ set(out_formats ${_format})
endif()
- set(${varname} ${found})
break()
endif()
endforeach()
+ set(${varname} ${out_formats})
endmacro()
macro(maketestname testname reverted listreverted listignored)