[CMake] CMAKE & Linux Environment variable

Jean-Christophe Fillion-Robin jchris.fillionr at kitware.com
Fri Jul 15 23:39:23 EDT 2011


Hi Kevyn-Alexandre,

Indeed, you can get or set environment variable from CMake.

For example:
  set(ENV{PATH} "/path/to/foo:$ENV{PATH}")

Hth
Jc

On Fri, Jul 15, 2011 at 6:02 PM, Kevyn-Alexandre Paré <
kapare at rogue-research.com> wrote:

> So I could simply get SVN_ROOT_PATH OE_PATH from
>
> $ENV{SVN_ROOT_PATH}
> $ENV{OE_PATH}
>
>
>
> On 2011-07-15, at 5:27 PM, Kevyn-Alexandre Paré wrote:
>
> > Hi,
> >
> > How do I make cmake to use environment variable?
> >
> > My context is that I want to have environment variable that represent my
> svn ROOT PATH (developer ENV.) and my open embedded path (in case of cross
> compiling). What's the best way to have something reusable for each
> developer?
> >
> >
> > EX:
> >
> > SOMEWHERE on my HD:
> >
> > SVN_ROOT_PATH
> >       Project
> >               trunk
> >                       Config
> >                               Config-Generic-cache.txt   #ARCH, COMPILER,
> FLAGS, build type
> >                               Config-Project-specific-cache.txt #
> COMPILATION PROJECT SPECIFIC
> >                       CMakeLists.txt
> >                       build
> >
> > SOMEWHERE else on my HD:
> > OE_PATH
> >
> > So for now I do this and hardcode the SVN_ROOT_PATH in
> Config-Generic-cache.txt:
> >
> > cd SVN_ROOT_PATH/Project/trunk/build
> > cmake -DCMAKE_SYSTEM_PROCESSOR:STRING=x86_64
> -DCMAKE_BUILD_TYPE:STRING=debug -C ../Config/Config-Generic-cache.txt  ../
> >
> >
> > Any suggestion to add the SVN_ROOT_PATH, best solution / best practice?
> >
> > Best Regards
> >
> > Kevyn-Alexandre
> >
> >
> > _______________________________________________
> > 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
>
> _______________________________________________
> 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
>



-- 
+1 919 869 8849
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110715/c3fd2642/attachment.htm>


More information about the CMake mailing list