On 09/25/2014 08:45 AM, Nils Gladitz wrote:
> @Brad: Before I rush into implementing anything and given that David 
> already raised concerns ... would anything like this be considered for 
> merge into CMake?

I'm not convinced it should be a builtin CMake feature.  KWSys provides
the "SharedForward" component specifically to help projects create
launcher executables like this.  It even helps create relocatable
binaries on *NIX without $ORIGIN, and works for redistributable
packages on both Windows and *NIX.  All of this works without any
special CMake features.

While it would be nice to provide a helper for applications to do this,
the only reason to include it in CMake would be to avoid an additional
external dependency for the application.  The same dependency management
argument could be made for any library, and we can't include the world
in CMake.

> $<TARGET_FILE> should continue to point at the real binary.
> A new $<TARGET_WRAPPER> could point at the wrapper binary.

The original purpose of $<TARGET_FILE> was for add_custom_command and
add_test to be able to refer to executables to run on command lines.
That would have to be the wrapper for this use case.  However, other
use cases may want to pass the real binary with $<TARGET_FILE>.
This makes the behavior of a magic wrapper hard to define in general,
so it would be better to have application code manage the separate
targets explicitly.

Note that CMake now has a "cmake -E env" feature that could be
used in custom commands and tests to set PATH before launching
an executable.

-Brad

-- 

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://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to