Fix corner case when an argument name is a variable.
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.
Please register or sign in to comment