Ah, that was indeed one error. There was another reason as well. A feature of qmake seems to be that custom compilers are not executed if the template is set to 'subdirs'. After I set it to lib it works fine. I just get a dummy empty library in the process but oh well...
Another annoying feature I discovered was that by default the files in installation sets are checked that they exists when qmake is run. This effectively prevents you from writing any installers for any generated files (like the .pdfs in my case). However after reading through the qmake source code, there is a nice undocumented option to disable that check.
Anyway here's my project file for reference if someone else runs into these problems:
# Dummy, just to get custom compilers to work in qmake
TEMPLATE = lib
TARGET = Dummy
# .tex files to build
TEX += help.tex
# Compiler for pdfs
doc_builder.name = tex2pdf
doc_builder.input = TEX
doc_builder.output = ${QMAKE_FILE_BASE}.pdf
doc_builder.commands = pdflatex ${QMAKE_FILE_BASE}
# This makes the custom compiler run before anything else
doc_builder.CONFIG += target_predeps
doc_builder.variable_out = documents.files
doc_builder.clean = ${QMAKE_FILE_BASE}.pdf \
${QMAKE_FILE_BASE}.aux \
${QMAKE_FILE_BASE}.toc \
${QMAKE_FILE_BASE}.log
QMAKE_EXTRA_COMPILERS += doc_builder
# Install documentation
documents.path = $$PREFIX/share/doc/
# If you don't specify this, all files must exist when you run qmake or else they will
# just silently be ignored
documents.CONFIG += no_check_exist
INSTALLS += documents
# Dummy, just to get custom compilers to work in qmake
TEMPLATE = lib
TARGET = Dummy
# .tex files to build
TEX += help.tex
# Compiler for pdfs
doc_builder.name = tex2pdf
doc_builder.input = TEX
doc_builder.output = ${QMAKE_FILE_BASE}.pdf
doc_builder.commands = pdflatex ${QMAKE_FILE_BASE}
# This makes the custom compiler run before anything else
doc_builder.CONFIG += target_predeps
doc_builder.variable_out = documents.files
doc_builder.clean = ${QMAKE_FILE_BASE}.pdf \
${QMAKE_FILE_BASE}.aux \
${QMAKE_FILE_BASE}.toc \
${QMAKE_FILE_BASE}.log
QMAKE_EXTRA_COMPILERS += doc_builder
# Install documentation
documents.path = $$PREFIX/share/doc/
# If you don't specify this, all files must exist when you run qmake or else they will
# just silently be ignored
documents.CONFIG += no_check_exist
INSTALLS += documents
To copy to clipboard, switch view to plain text mode
I still have to check if there's a way to get rid of the dummy library, but it will do for now.
Bookmarks