[Cmake] dependencies

Bill Hoffman bill . hoffman at kitware . com
Mon, 12 Nov 2001 15:01:18 -0400


OK, I think I figured out what might work for you.
In your command to generate the .h file use the following
method: cmMakefile::AddCMakeDependFile to add the generated
.h file to the list of things that the makefile depends on.

This will cause the following rule:

cmake.depends : path/to/your/file.h

and since, you have a rule:

path/to/your/file.h:
  moc > path/to/your/file.h 

It will cause it to be generated before the depend step is run.

As for < vs. " for includes I am not sure what is wrong there.

-Bill


At 07:23 PM 11/12/2001 +0000, Franck Bettinger wrote:
>Hi Bill,
>
>In fact it's not as easy as that.
>The file drawingimpl.cxx include drawingimpl.h and drawingimpl.h includes 
>drawing.h
>So drawing.h is not in the cmake.depends file, but drawingimpl.h is.
>Unfortunately, as there is no make rule for drawingimpl.h, there's no link to 
>drawing.h in cmake.depends.
>
>Furthermore, if I include drawing.h in drawingimpl.h, I can only find 
>drawing.h in cmake.depends if I use the syntax :
>#include <drawing.h>
>
>Other syntaxes like
>#include "drawing.h"
>or
>#include <drawing/drawing.h>
>don't work.
>
>In the case I use the first syntax, I have the line : 
>drawing.h \
>in cmake.depends.
>
>The "make" utility doesn't seem to be able to match that to the full path 
>name as used in the rule for creating drawing.h in Makefile (certainly 
>because drawing.h is not in the source directory but in the object directory 
>because it is a generated file). 
>I can change this rule to use only the name of the file, but I would like a 
>proper solution with the full pathname as it might be a problem if it's used 
>in a library, and also for consistency with the rest of the Makefile. 
>Furthermore I don't know if this patchy solution would be crossplatform.
>
>Concerning ADD_DEPENDENCIES, I think it's strange to have to link executable. 
>What we would certainly need is the possiblitity of linking generated files. 
>And it's the way I've (mis)understood the command.
>
>Franck
>
>
>On Monday 12 November 2001 17:21, Bill Hoffman wrote:
>> The ADD_DEPENDENCIES command is only used to add dependencies between one
>> executable and another. Regular build dependencies are handled
>> automatically.
>>
>> If drawingimpl.cxx includes drawing.h the depend should be in
>> cmake.depends.
>>
>> -Bill
>>
>> At 04:31 PM 11/12/2001 +0000, Franck Bettinger wrote:
>> >Hi,
>> >
>> >I tried to add a dependency that was not automatically generated by cmake
>> > in a CMakeList.txt using the command:
>> >
>> >ADD_DEPENDENCIES(drawingimpl.cxx
>> >${allvxl_SOURCE_DIR}/obj/programs/drawing/drawing.h)
>> >
>> >Apparently it doesn't change anything in the generated Makefile (at least
>> > on linux). Anyone has any idea why it does this, or how can I add a user
>> > defined dependency ?
>> >
>> >Cheers,
>> >Franck
>> >_______________________________________________
>> >Cmake mailing list
>> >Cmake at public . kitware . com
>> >http://public . kitware . com/mailman/listinfo/cmake
>>
>> _______________________________________________
>> Cmake mailing list
>> Cmake at public . kitware . com
>> http://public . kitware . com/mailman/listinfo/cmake
>
>_______________________________________________
>Cmake mailing list
>Cmake at public . kitware . com
>http://public . kitware . com/mailman/listinfo/cmake