[Cmake] Environment variables

Nils H. Busch nilsb at cns.mpg.de
Mon Feb 10 10:55:21 EST 2003


Brad King wrote:

> > is it possible with CMake to query unix environment variables and set
> > CMake vars accordingly, something like SET(A_CMAKE_VAR "$(A_UNIX_VAR)")
>
> Yes:
>
> SET(A_CMAKE_VAR "$ENV{A_UNIX_VAR}")
>

Thanks.

>
> > Is it possible to read/convert information from a project not generated
> > by CMake e.g. makefile content into a CMake project ? Basically, I want
> > to convert variables in Makefile convention ($(A_VAR)) to CMake
> > variables.
>
> I'm not sure what you're asking here.  Do you want to convert a
> Makefile-built project to CMake, or use a Makefile-built project from a
> separate CMake-built project?
>
> In either case, just about anything is possible with CMake 1.6 because it
> has support for writing custom CMake list file commands in C and
> compiling/loading them when CMake runs.  You could write a C command to
> parse the Makefile and set CMake variables.
>
> -Brad

Ok. What I meant was, parsing a Makefile and retrieving variable values from
it and setting appropriate CMake variables. But I guess, this requires as
you said, writing a C program that does that. I was hoping that there is
some mechanism within CMake that does the parsing, as I am currently using
CMake v. 1.4.7.
I guess, I need to upgrade.

--
    Nils H. Busch
    Max-Planck-Institute of Cognitive Neuroscience
    phone:  ++49 (341) 9940-035 fax:  ++49 (341) 9940-204
    e-mail: nilsb at cns.mpg.de






More information about the CMake mailing list