[CMake] refering to top-level project as a target in a subdir's cmakelists.txt

MM finjulhich at gmail.com
Mon Jul 20 14:37:45 EDT 2015


>
> On 20 July 2015 at 18:52, Micha Hergarden <micha.hergarden at gmail.com>
> wrote:
>
>>  On 07/20/2015 05:16 PM, MM wrote:
>>
>> I want to refer to
>>
>>  == toplevl cmakelists file ===
>> PROJECT(prj)
>> ADD_SUBDIRECTORY(dir1)
>>
>>  ==dir1 cmakelists.txt===
>> ADD_CUSTOM_COMMAND( TARGET prj  # this doesn't work
>> )
>>
>>
>>  In what way do you want to refer to it? You may want to use the DEPENDS
>> parameter here. Do I understand correctly that you want to add a custom
>> command that depends on the whole project the custom command is part of?
>> Does that not imply a cyclic dependency?
>>
>> Regards,
>> Micha
>>
>
> Apologies for the mis-click,

Maybe right about the cyclic dependency,

I used instead a cmakefile-local custom target to run all the time... with
ALL.

Yes i have a DEPENDS.

What I want is this command to run post build of the entire project (my top
level project), this command produces a sql file,
and I want it only to run if any of its dependencies changed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150720/b6628159/attachment.html>


More information about the CMake mailing list