How do I get LaTeX references to be correct?
When your latex document contains references (e.g. \ref{…} command) you get to run two passes of latex. In the most general case, i.e. when additionally your document uses a bibtex bibliography, you shall need three passes of latex (and one pass of bibtex): • latex (first pass: for bibtex to have an .aux file) • bibtex (for generating the .bbl file) • latex (second pass) • latex (third pass) The following code snippet illustrates how you can “pervert” the bibtex and latex generated auxilary files (.aux, .log, .dvi, .bbl…) to create an “artificial” set of CMake dependencies.