[CMake] help with learning add_library

luxInteg lux-integ at btconnect.com
Sat Nov 6 12:26:11 EDT 2010


Greetings,

I am learning cmake.

I have a question on  using add_library.  in my  project(learnCMAKE).  The 
latter has:-

---a) 2  source files   file1.c  file2.c
---b) the envar {CFLAGS}  set
---c)  need to generate  libLearnCMAKE.so and libLearnCMAKE.a
---d) need  to add preprocessor agruments -DXXX to CFLAGS  in the compilation 
of  the source files  before liberies are archived  like so:-

gcc ${CFLAGS} -DDINT /path/to/file1.c
gcc ${CFLAGS} -DDINT /path/to/file2.c

gcc ${CFLAGS} -DDLONG /path/to/file1.c
gcc ${CFLAGS} -DDLONG /path/to/file2.c

How can this be achived in a marco or whatever with add_library ?
Help would be appreciated

sincerely
lux-integ


More information about the CMake mailing list