Using CMake I try to expand environment variable values in custom file. I do the following
configure_file(config.cnf.in config.cnf)
I do not use @ONLY attribute.
config.cnf.in
content:
[options]
some_value1 = @VAR_FROM_CMAKE@ // ok
some_value2 = ${SYSTEM_ENV_VAR} // empty result
some_value2 = ${VAR_FROM_CMAKE} // ok -- from CMake?!
@VAR_FROM_CMAKE@
is expanded successfully, but
${SYSTEM_ENV_VAR}
is not - empty value.
I confused - @VAR@
and ${VAR}
- are leading only to the CMAKE variables, but not to system env?
So my question is: Is it possible to expand system env variables in the custom file using CMake?