[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    Re: [CMake] Custom Commands and Environmnt Settings for PATH and LD_LIBRARY_PATH
From:       Matthew Woehlke <mw_triad () users ! sourceforge ! net>
Date:       2014-04-21 17:30:53
Message-ID: lj3kkd$lvg$1 () ger ! gmane ! org
[Download RAW message or body]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic