[CMake] Question about FOREACH
Filipe Sousa
filipe at ipb.pt
Tue May 24 13:36:39 EDT 2005
On Tuesday 24 May 2005 18:32, Filipe Sousa wrote:
> On Tuesday 24 May 2005 18:23, alaterale at elitemail.org wrote:
> > Hi,
> > I have a quick question about the FOREACH command. I'm basically trying
> > to execute the "env" program and be able to parse specific environment
> > variables into cmake variables. So here's what I'm doing so far:
> >
> > EXEC_PROGRAM("env > env.txt")
> > FILE(READ "env.txt" ENVIRONMENT_VARIABLES)
> >
> > Now, I need to be able to use FOREACH to iterate through the file
> > contents based on some delimiter (preferably "/n" since that's what the
> > file is delimited on by default)
> >
> > I have this so far but it doesn't work:
> > FOREACH(VAR ENVIRONMENT_VARIABLES)
> > MESSAGE(STATUS ${VAR})
> > ENDFOREACH(VAR ENVIRONMENT_VARIABLES)
> >
> > I guess all this would be unnecessary if there were a way to just
> > retrieve real environment variables from the system, but I have not
>
> $ENV{YOUR_ENVIRONMET_VARIABLE}
>
> > figured that out yet :P So I guess if anyone knows how to get and set
SET(ENV{YOUR_ENVIRONMET_VARIABLE} "hello world")
> > environment variables from cmake, that would help too. Thanks!
> > ~~J Strange
> > _______________________________________________
> > CMake mailing list
> > CMake at cmake.org
> > http://www.cmake.org/mailman/listinfo/cmake
--
Filipe Sousa
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20050524/3cf3a2b1/attachment.pgp
More information about the CMake
mailing list