[CMake] Question about ADD_CUSTOM_COMMAND

Carminati Federico Federico.Carminati at cern.ch
Sat Feb 12 09:00:49 EST 2011


Dear All,
    I have a question about ADD_CUSTOM_COMMAND. I read in the doc

"If DEPENDS specifies any target (created by an ADD_* command) a target-level dependency is created to make sure the target is built before any target using this custom command. Additionally, if the target is an executable or library a file-level dependency is created to cause the custom command to re-run whenever the target is recompiled."

However if I add to the DEPENDS list a target built with ADD_CUSTOM_TARGET, first the target is correctly scanned and built, then make crashes because it considers it also a file dependencies and looks for a file with the same name of the target. Is this the normal behaviour? I can fix it with

ADD_CUSTOM_TARGET(all-todo COMMAND touch all-todo)
ADD_CUSTOM_COMMAND(OUTPUT ... COMMAND ... DEPENDS all-todo ....)


Thanks and best regards, 

Federico Carminati
CERN-PH 
1211 Geneva 23
Switzerland
Tel: +41 22 76 74959
Fax: +41 22 76 68505
Mobile: +41 76 487 4843





More information about the CMake mailing list