[CMake] is it possbile to export environment varibles from cmake scripts?

Alexander Bubnov alexander.bubnov at gmail.com
Mon Jul 7 07:53:00 EDT 2008


Hello!

Below simple example to clarify the problem.

My CMakeLists.txt:

cmake_minimum_required(VERSION 2.6)

set(ENV{MYVAR} "SOME VALUE")
message("the value of MYVAR: " $ENV{MYVAR})

the output:

the value of MYVAR: SOME VALUE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/alek/trial/cmake/CMakeExample


after that I am typing: echo $MYVAR
MYVAR: Undefined variable.

Is it possible to export MYVAR to shell environment?

Thanks in advance.

-- 
/BR, Alexander


More information about the CMake mailing list