[cmake-developers] [CMake] Export environment variables in generated Makefile

Taylor Braun-Jones taylor at braun-jones.org
Sun May 17 00:35:17 EDT 2015


On May 16, 2015 12:18 PM, "Dan Kegel" <dank at kegel.com> wrote:

> Write a wrapper script that sets the variables and invokes the compiler,
> and tell cmake that's your compiler.
>

Ya, I thought about this but aside from having an interceptor for an
interceptor there are also other complexities like:

(1) One of the values contains the path to the build dir so now I'd need to
_generate_ the interceptor script that I want to use as my
CMAKE_CXX_COMPILER.

(2) I also want the environment variables to be visible to the executables
that get invoked when building various other targets. Since the paths to
these executables get discovered by CMake (they are not necessarily in the
system PATH) I'd be stuck generating several wrapper/interceptor scripts.

These issues could likely be overcome with workarounds, but I'm trying hard
to keep the build simple and understandable. Since CMake already has an
ENVIRONMENT property for tests[1] it seemed like a reasonable and symmetric
feature would be to support an ENVIRONMENT property for targets as well.

Taylor

[1]
http://www.cmake.org/cmake/help/v3.2/manual/cmake-properties.7.html#properties-on-tests
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150517/5d2bac7d/attachment.html>


More information about the cmake-developers mailing list