[Cmake] ADD_DEFINITION to a specific target

Marc Traina Marc.Traina at sophia.inria.fr
Wed Apr 9 13:40:07 EDT 2003


Hi,

How can I create several libraries from the same source files with 
different compilation flags ?

I would like to use a command like ADD_DEFINITIONS but specific to a 
target, for instance TARGET_ADD_DEFINITIONS.
*||*
Example :
    ADD_DEFINITIONS(-DBAR)
    ADD_LIBRARY(MyLib   fic1.cxx   fic2.cxx)
    ADD_LIBRARY(MyLib_FOO   fic1.cxx   fic2.cxx)
    TARGET_ADD_DEFINITIONS(MyLib_FOO -DFOO)

automake manage that by prefixing the ".o" files by the name of the target.
    ex : MyLib_FOO_fic1.o  and  MyLib_FOO_fic2.o

and link that two files to create MyLib_FOO library.

Thanks

Marc






More information about the CMake mailing list