[CMake] Extending a target??

Michael Wild themiwi at gmail.com
Wed Jun 2 12:44:30 EDT 2010


On 2. Jun, 2010, at 17:51 , Doug Reiland wrote:

> Yeah, I know I can do that.
> I want to add foo3.c after the add_library() has been done.
> The example is simple, but it describes what I hope to do.
> 
> 
> On Wed, Jun 2, 2010 at 11:41 AM, Michael Wild <themiwi at gmail.com> wrote:
>> 
>> On 2. Jun, 2010, at 16:34 , Doug Reiland wrote:
>> 
>>> Is there anything to "add to" a target after it is declared?
>>> 
>>> For example,
>>> 
>>> add_library(foo STATIC foo1.c foo2.c)
>>> 
>>> ....
>>> 
>>> add_some_more(foo foo3.c)
>>> or
>>> add_some_more(foo foo3.o)
>>> 
>>> If not, feasibility on how it could be implemented?
>>> 
>>> Thanks,
>>> Doug
>> 
>> set(SRCS foo1.c foo2.c)
>> if(SOME_CONDITION)
>> list(APPEND SRCS foo3.c)
>> endif()
>> add_library(foo STATIC ${SRCS})
>> 
>> 
>> Hope this helps
>> 
>> Michael
>> 

No, AFAIK there is no way to do so. Perhaps if you explained a bit more why you think you need such a feature we could help you a bit more.

Michael


More information about the CMake mailing list