On 2014-04-11 05:32, Jörg Kreuzberger wrote:
[stuff about environment and custom commands]
So it would help to have a possiblity to have a custom command like this:
add_custom_command( OUTPUT <out>
COMMAND ..
COMMAND ..
ENVIRONMENT PATH=$ENV{PATH}
ENVIRONMENT LD_LIBRARY=
I'm pretty sure this is not the first time this sort of thing has come
up. It would indeed be useful to be able to pass environment values to a
custom command without having to roll your own wrapper script. However,
because the command must be run by the build too, I believe a wrapper of
some sort is unavoidable (though on POSIX platforms, 'env' can possibly
serve this purpose).
Bonus points for supporting '{PRE,AP}PEND ENVIRONMENT' which would
automatically use the platform-appropriate PATH separator to
prepend/append a specified value to an environment variable (omitting
the separator if the variable is empty).
However, to do this, I think you would need to teach CMake a new command
mode, e.g.:
cmake -E env VAR1=VALUE VAR2:=PREPEND_VALUE VAR3+=APPEND_VALUE \
command args
I think this would be a nice feature to have, though.
--
Matthew
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake