cmake export tests.

Define new policy of what export formats to check.
Depending on default_output_format
default or unset           xhtml, dvi*, pdf*
xhtml                      xhtml
any of pfd variants        xhtml, pdf*
any of dvi variants        xhtml, dvi*
each other (like eps3)     as specified
This commit is contained in:
Kornel Benko 2014-03-16 09:57:31 +01:00
parent af61ca9df6
commit 7ecbb06888

View File

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