[CMake] Extending a target??

Michael Wild themiwi at gmail.com
Wed Jun 2 11:41:09 EDT 2010


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


More information about the CMake mailing list