Issue with CMake > 3.28 in Windows if LaTeX install directory contains spaces.
It seems that there is an issue with UseLATEX under Windows, starting with CMake Version 3.28+. If the install directory of the local TeX distribution contains a whitespace character, e.g., C:\Program Files\texlive\2024\bin\windows\pdflatex.exe
, the execute_process
with the ${LATEX_FULL_COMMAND}
fails. The ${LATEX_FULL_COMMAND}
is provided with e.g. the pdflatex_build_command
, which in turn uses the ${PDFLATEX_COMPILER}
variable. The ${PDFLATEX_COMPILER}
variable should be provided by find_package(LATEX)
. The same also holds for BibTeX and BibLaTeX compilers, as well as all other tools with paths provided by the find_package(LATEX)
module.
A workaround is to manually set the ${PDFLATEX_COMPILER}
as well as ${BIBTEX_COMPILER}
${BIBER_COMPILER}
to the desired commands themselves without the full paths, which should be in the PATH
environment variable anyway.
I was not successful with simply escaping the ${PDFLATEX_COMPILER}
variable (and associated other compiler variables) in UseLATEX, however...
I have found a related issue here: cmake/cmake#25835 (closed)