LaTeX "helpfully" split across lines (and which fowled up our regex).
Get around the problem by instead searching for "LaTeX Warning:" at
the beginning of the line. Hopefully (1) all versions of LaTeX
actually write this out and (2) it is not used for trivial
warnings.
This prevents a needless dependency on ImageMagick if all images are already
in formats suitable for pdflatex, but would need to be converted to .eps for DVI builds.
When using the synctex option with pdflatex, it writes out a file
containing paths to the input files. The problem is that
UseLATEX.cmake copies all the input files, so you get a link to
the copy, not the original. To correct for this UseLATEX.cmake
changed the directories back to the input files, but it only
did so for relative paths. pdflatex writes out absolute paths,
so these were not properly converted. This should fix that issue.
I also noticed that some of the "input" files are actually those
produced by latex programs (e.g. .aux, .bbl). Trying to convert
these paths to the input would cause pointers to files that do
not exist. To try to correct for this I only convert paths of
files of known extensions.
There was a reference to using VERSION_GREATER_EQUAL. However, this
conditional is only supported in CMake 3.7 and better. Instead,
use VERSION_GREATER, which is supported in much older versions
of CMake.
When running LaTeX in batch mode, it might not print any output when a
failure occurs. So, when running in this mode, cat out the log failure
if a LaTeX error occurs.
The implementation for this wraps the latex call in a CMake script
that runs latex and checks the return value. If not a success value,
reads and then prints the log.
They make the output much less verbose and also add file/line numbers
to errors. This mode is much nicer output for build systems. Thanks to
Nikos Koukis for the suggestion.
The ps2pdf command is really just a script, and on the Windows port
it is a bat file. The Windows command interpreter for bat files treat
= as a special character, so on Windows you should use # instead.
The _FLAGS CMake variables are specified as space-separated arguments
to make them easier to type. However, they have to be converted to CMake
lists to pass them to CMake commands that run programs. Otherwise they
will be interpreted as a single argument.
There were some separate_arguments commands to do just that. However,
I think when I changed over from defining macros to defining functions,
the scope of the separated arguments broke. This should fix that.
A user reported that converting a pdf to an eps was failing because his
pdftops program, which was a recent build/release, did not support the
-r flag, which sets the resolution used when objects are rasterized.
After some searching, I believe the issue is that there are two versions
of pdftops running around: one from Poppler and one from Xpdf. The former
supports the raster resolution flag, the latter does not.
Rather than jump through hoops trying to identify which one is installed
on a system, I just removed the flag. The consequence is that rasterized
objects will use a smaller resolution (the default is 300 dpi, and we were
setting it to 600 dpi). However, if you start engaging rasterization, then
the result probably is not looking as good anyway.
It looks like with the release of ImageMagick 7.0 that the name of the
convert program has been renamed to magick. Most implementation have a
link from convert to magick, but the windows install by default does
not provide a convert program. To make sure it works everywhere, search
for both programs (searching for magick first).
Previously, UseLATEX.cmake was calling latex_needit for the
BIBLATEX_COMPILER variable. However, this variable was never set
because the FindLATEX module sets the BIBER_COMPILER variable instead.
Look for that variable.
Other minor changes include updating the documenting comments and calling
wantit rather than needit on the biber compiler just in case there are
latex installations without it.
A user requested the ability to make the target names created by UseLATEX
different than the name of the main tex file. The use case was for a
multi-directory project with two or more subdirectories containing LaTeX
files with the same name.
In a large project, it is not uncommon to have LaTeX documents built in
different subdirectories and to have each subdirectory include
UseLATEX.cmake. However, loading UseLATEX.cmake multiple times caused
the pdf, dvi, etc. targets to be created multiple times even though the
intention is to have them loaded once. This change creates each target
only once.
Previously, the EXCLUDE_FROM_ALL option broke both the dependency from
the all target and the dependency from the dvi, pdf, etc. targets. However,
there is plenty of reason to want only one or the other, so the
EXCLUDE_FROM_ALL option was broken up into a second EXCLUDE_FROM_DEFAULTS
that controls the second set of dependencies.
Removed the DEFAULT_* arguments. Instead, have a CMake variable named
LATEX_DEFAULT_BUILD that specifies what the default build should be.
This CMake variable is initialized with an environment variable of the
same name or PDF if none is specified. This allows each user to specify
a default build without having to change the configuration.
There is also an EXCLUDE_FROM_ALL option that, like the same option in
add_executable, keeps the document from being built in the default all
target.
UseLATEX.cmake finds several executables for compiling documents and
converting files. Previously these were not marked as advanced, but
CMake now conventionally makes them advanced to avoid cluttering the
GUI.