[CMake] help with learning add_library

Gerhard Gappmeier gerhard.gappmeier at ascolab.com
Sat Nov 6 12:31:05 EDT 2010


Hi again,

I'v forgotten the envar question in the mail before.
If you really want to set additional options from outside CMakeLists.txt you 
can do this:

add_defintions($ENV{CFLAGS})

using $ENV{} you can access any environment variable.

On Saturday 06 November 2010 17:26:11 luxInteg wrote:
> 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
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake

-- 
mit freundlichen Grüßen / best regards

*Gerhard Gappmeier*
ascolab GmbH - automation systems communication laboratory
Tel.: +49 9131 691 123
Fax: +49 9131 691 128
Web: http://www.ascolab.com
GPG Key Id: 5AAC50C4
GPG Fingerprint: 967A 15F1 2788 164D CCA3 6C46 07CD 6F82 5AAC 50C4

--
*ascolab GmbH*
Geschäftsführer: Gerhard Gappmeier, Matthias Damm, Uwe Steinkrauß
Sitz der Gesellschaft: Am Weichselgarten 7 . 91058 Erlangen . Germany
Registernummer: HRB 9360
Registergericht: Amtsgericht Fürth


More information about the CMake mailing list