cmake runs the custom command when all outputs have later times than all inputs
The verilator project (https://github.com/verilator/verilator) installs the custom cmake procedure verilate
, which runs this custom target:
add_custom_command(OUTPUT ${GENERATED_SOURCES} "${VCMAKE}"
COMMENT "YURI: Running custom_command VERILATOR_COMMAND"
COMMAND ${VERILATOR_COMMAND}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
DEPENDS "${VERILATOR_BIN}" ${${VERILATE_PREFIX}_DEPS} VERBATIM)
cmake runs this custom command regardless of DEPENDS/OUTPUTS times. I verified that times of all of "${VERILATOR_BIN}" ${${VERILATE_PREFIX}_DEPS}
are earlier than the times of all of ${GENERATED_SOURCES} "${VCMAKE}"
, but it still runs this command, and the COMMENT
string is printed.
The consequence is that the expensive verilator
command, and subsequent C++ compilations are rerun when nothing has changed.
How can I understand why is this command run regardless of file times?
OS: FreeBSD 12.2
cmake-3.18.2
gmake-4.3_2