[CMake] [solved sort of] Re: add_custom_command and re-running command when target in DEPENDS was updated

Maciej Mrozowski reavertm at gmail.com
Tue Aug 30 19:17:07 EDT 2016


On poniedziałek, 29 sierpnia 2016 23:44:30 CEST you wrote:
> On poniedziałek, 29 sierpnia 2016 23:31:59 CEST you wrote:
> > add_custom_command documentation says:
> > 
> > <quote>
> > The DEPENDS option specifies files on which the command depends. If any
> > dependency is an OUTPUT of another custom command in the same directory
> > (CMakeLists.txt file) CMake automatically brings the other custom command
> > into the target in which this command is built.
> 
> One possibly important note I forgot.
> Mentioned add_jar and add_custom_command in my case are NOT in the same
> directory, but I guess it should not matter since I have explicit 'DEPENDS
> generator'?

Strangely enough, it is now sort of solved/worked around, though I still don't 
fully understand why.

I think I placed:

set_source_file_properties(
  ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp
  PROPERTIES OBJECT_DEPENDS ${GENERATOR_PATH}
)

after custom command definition and not before like previously I tried that 
(like it mattered whether it's before or after?) and touching file under $
{GENERATOR_PATH} actually triggers command to be re-run.

Still I would like to know how to make command re-run in better way.

-- 
regards
MM


More information about the CMake mailing list