[cmake-developers] [PATCH] Discussion needed: FindBISON: refine VERBOSE feature of BISON_TARGET
Brad King
brad.king at kitware.com
Wed Jun 24 11:29:24 EDT 2015
On 06/24/2015 11:13 AM, 정언 wrote:
> The copying command should be run right after each execution of bison.
Yes.
> However, add_custom_command never guarantees a running order of
> internal commands. The documentation says, the commands can run
> parallel so never ever put commands with implicit dependencies.
I'm not sure what text from the documentation you're referencing,
but I think that is warning about listing one output in multiple
independent targets, e.g.
add_custom_command(OUTPUT out.txt ...)
add_custom_target(tgt1 DEPENDS out.txt)
add_custom_target(tgt2 DEPENDS out.txt)
That is not the case here.
> Again, we have two custom commands as a result of passing `VERBOSE` to
> bison_target(). One runs bison, and the other runs cp.
We only need one add_custom_command call. It can list both outputs
and have two COMMAND arguments. Something like (untested):
if(...)
set(_maybe_copy_verbose_output ${BISON_TARGET_ARG_VERBOSE})
set(_maybe_copy_verbose_command
COMMAND ${CMAKE_COMMAND} -E copy ${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output ${BISON_TARGET_ARG_VERBOSE}
)
endif()
add_custom_command(OUTPUT ${BISON_TARGET_outputs} ${_maybe_copy_verbose_output}
${BISON_TARGET_extraoutputs}
COMMAND ${BISON_EXECUTABLE} ${BISON_TARGET_cmdopt} -o ${BisonOutput} ${BisonInput}
${_maybe_copy_verbose_command}
DEPENDS ${BisonInput}
COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
When both COMMAND options are present they will run sequentially.
> If VERBOSE behaved right, REPORT_FILE would not have any benefits over it.
Wouldn't it be able to skip the intermediate file and copy step?
-Brad
More information about the cmake-developers
mailing list