When parsing arguments, there is an IF statement that compares an
argument to an argument name (such as BIBFILES, IMAGES, etc.).
If there exists a variable with the same name, then the IF statement
will also try to dereference the variable and compare them. Thus,
if that variable equaled one of the arguments, it would be incorrectly
identified as an argument name.
As an example, consider this CMake code.
set(BIBFILES mydoc.bib)
add_latex_document(mydoc.tex BIBFILES ${BIBFILES})
These arguments, obviously, expand to "mydoc.tex;BIBFILES;mydoc.bib".
When checking the argument mydoc.bib, you would expect it to be
considered an argument to BIBFILES. However, deep in the call stack
there is an if statement that expands to
IF (BIBFILES STREQUAL mydoc.bib)
Clearly we mean these to be unequal. But because BIBFILES is also
a variable containing mydoc.bib, CMake considers this to be true.
Thus, UseLATEX though mydoc.bib was the start of a list of bibliography
files rather than a bibliography file itself.
The problem is solved by prepending "non_a_var_" to each string we
are comparing.
IF (not_a_var_BIBFILES STREQUAL not_a_var_mydoc.bib)
This makes it highly unlikely that either side of this comparison
will be a variable that gets expanded.
Add all known auxiliary files that LaTeX generates to the clean target.
Also add the final generated files (dvi, ps, pdf). Also add these
files to the auxclean target, which differs from the regular clean
in that it does not clean things like images that take a while to
rebuild.
These changes include:
* General cleanup of extranous code.
* Remove USE_NOMENCLATURES option. This mimiced the USE_GLOSSARIES
option, which is only there for backward compatibility purposes.
* Change USE_NOMENCLATURE to USE_NOMENCL to tie it directly to the
nomencl package. This is defensive in case someone wants to use
a similar nomenclature package with a slightly different name.