[Cmake] Environment variables

Brad King brad.king at kitware.com
Mon Feb 10 09:26:18 EST 2003


> 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}")

> 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




More information about the CMake mailing list