[CMake] CMake 2.5 GENERATED true bug

Brandon J. Van Every bvanevery at gmail.com
Sat May 13 03:03:56 EDT 2006


William A. Hoffman wrote:
> ADD_DEPENDENCIES is only for adding depends between two targets.  It can not
> be used for files.  You have to use the DEPENDS on the ADD_CUSTOM_COMMAND.
>   
No I don't.  You didn't tell me to RTFM and use the AddFileDependencies 
module.  :-)  It seems to work, knock on wood.

I don't think it is logical for ADD_DEPENDENCIES to be so restricted.  I 
tried to hack my way around the problem with the following macro.  But, 
it's noisy; a COMMENT "" doesn't suppress the default "Generating 
whatever" message.  Moreover, the new (blank) commands cancel the old 
(intended) commands.  Not what I wanted!


MACRO(ADD_CUSTOM_DEPENDENCIES target)
  # After target, you supply any number of dependencies.
  # Put all optional arguments in deps.
  SET(deps ${ARGV})
  LIST(REMOVE_ITEM deps 0)
  ADD_CUSTOM_COMMAND(
    OUTPUT ${target}
    DEPENDS ${deps}
    COMMENT "${target} dependencies"
  )
ENDMACRO(ADD_CUSTOM_DEPENDENCIES)



Cheers,
Brandon Van Every



More information about the CMake mailing list