[CMake] how to add sources conditionally?

Prakash Punnoor lists at punnoor.de
Fri Nov 18 14:17:06 EST 2005


Hi,

I have new problem: I am trying something like this:

SET(SRC1 foo.c)
SET(SRC2 bar.c)

IF(COND1)
SET(SRCS "${SRCS} ${SRC1}")
ENDIF(COND1)

IF(COND2)
SET(SRCS "${SRCS} ${SRC2}")
ENDIF(COND2)

ADD_LIBRARY(test ${SRCS})

But this doesn't work. cmake doesn't get the paths fully expanded and
complains about not finding source files. What would be the correct way
to do something like above?

Thx,

Prakash
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://public.kitware.com/pipermail/cmake/attachments/20051118/2bb0217a/signature.pgp


More information about the CMake mailing list