[CMake] delayed target

Michael Hertling mhertling at online.de
Thu Feb 23 00:18:10 EST 2012


On 02/22/2012 11:55 PM, Andrea Crotti wrote:
> On 02/22/2012 09:37 PM, Michael Hertling wrote:
>>
>> In order to define one target per egg, you'd need to know the eggs at
>> configuration time since you cannot define targets at build time. So,
>> gathering the eggs with a custom target/command will not work. As an
>> alternative, you might gather the eggs at configuration time with a
>> FILE(GLOB ...) command, loop over the resulting list and define one
>> target per item. However, your Makefiles would not be aware of any
>> changes among the eggs - additions, removals, renamings - and you
>> would need to remember to reconfigure your project by hand if you
>> don't want to miss any changes. That's somewhat error-prone and
>> means relinquishing one of CMake's benefits.
>>
>> Regards,
>>
>> Michael
>> -
> Yes sure when there are changes in that sense we need to reconfigure,
> but it's really not a big deal in our case because it won't almost never 
> happen,
> and anyway I don't really have any other choice if I want to use the 
> parallelization
> provided by make -j.

There is a possibility to dynamically reconfigure/rebuild the project
without an intermediate manual step and in a way that you'll have one
target per egg, but that approach is disadvantageous in other regards
and possibly won't work with generators other than the Makefiles ones.

IMO, if you really need one target per egg, you should gather them at
configure time and accept the need to reconfigure the project by hand
when necessary. If one target per egg isn't a must-do, gather them at
build time and use a script - CMake, shell, whatever - to unzip them;
this can be done well in parallel also.

Regards,

Michael


More information about the CMake mailing list