[CMake] Question about FOREACH

Filipe Sousa filipe at ipb.pt
Tue May 24 13:32:26 EDT 2005


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
> 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/1946b833/attachment.pgp


More information about the CMake mailing list