Control: tags -1 + wontfix Control: notfound -1 3.31.6-2
Hi,On Fri, 08 May 2026 16:03:38 +0200 Christophe Delahaye <[email protected]> wrote:
# !!? This command make the application object file disappear in the
linker command line, leaving only the libraries. So the linker
rightly protests about a missing main() symbol.
# add_custom_command(
# OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/dox_svn-umilo.pdf"
# COMMAND doxygen ${CMAKE_CURRENT_BINARY_DIR}/dox_svn-umilo.conf
# COMMAND sh -c 'cd dox_svn-umilo/latex && ${PDFLATEX_COMPILER}
refman.tex'
# COMMAND mv ${CMAKE_CURRENT_BINARY_DIR}/dox_svn-umilo/latex/refman.pdf
${CMAKE_CURRENT_BINARY_DIR}/dox_svn-umilo.pdf
# MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/svn-umilo.cpp
# DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dox_svn-umilo.conf
# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
# COMMENT "Génération de la documentation Doxygen au format HTML et LaTeX, et
composition du LaTeX en PDF"
# )
The issue is the MAIN_DEPENDENCY, which does not behave as you expect.
The documentation [1] says:
MAIN_DEPENDENCY
Specify the primary input source file to the command.
[...]
Each source file may have at most one command specifying it as its
main dependency. A compile command (i.e. for a library or an
executable) counts as an implicit main dependency which gets
silently overwritten by a custom command specification.
The reason for this design is the Visual Studio
Code Generator, which attaches rules to sources instead of outputs.
The correct solution in your case is to put everything under DEPENDS
and not use MAIN_DEPENDENCY at all.
Cheers
Timo
[1] https://cmake.org/cmake/help/latest/command/add_custom_command.html
--
⢀⣴⠾⠻⢶⣦⠀ ╭────────────────────────────────────────────────────╮
⣾⠁⢠⠒⠀⣿⡁ │ Timo Röhling │
⢿⡄⠘⠷⠚⠋⠀ │ 9B03 EBB9 8300 DF97 C2B1 23BF CC8C 6BDD 1403 F4CA │
⠈⠳⣄⠀⠀⠀⠀ ╰────────────────────────────────────────────────────╯
signature.asc
Description: PGP signature

