[CMake] RULE_LAUNCH_LINK with non-Makefile generators
Jozsef Bakosi
jbakosi at gmail.com
Wed May 7 15:32:31 EDT 2014
Hi folks,
my previous post, titled "Produce only an object file (*.o) from a CMake
build target", in response to an older
post<http://www.cmake.org/pipermail/cmake/2011-January/042284.html>
did
not go through correctly, so I will state my question again:
I'm trying to generate a custom link line for a single target by hijacking
the cmake-generated link line using the idea in the previous post linked
above. Essentially, prefixing the link line with a shell script that
replaces the linker executable <CMAKE_CXX_COMPILER> in the link rule
via RULE_LAUNCH_LINK, which works fine. Example:
set_target_properties(${TARGET} PROPERTIES RULE_LAUNCH_LINK
"${CMAKE_CURRENT_SOURCE_DIR}/hijack.sh ${MY_CUSTOM_LINKER}"
where hijack.sh is:
#!/bin/sh
comp=$1 # save MY_CUSTOM_LINKER
shift 2 # skip the cmake-generated linker
for var in "$@"; do comp="$comp $var"; done # add rest of arguments
$comp # link with MY_CUSTOM_LINKER
This works fine with make, but RULE_LAUNCH_LINK only works with Makefile
generators.
Are there any plans supporting RULE_LAUNCH_LINK with ninja?
Is there another way to replace the linker executable for a single file?
Thanks,
Jozsef
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140507/6480013e/attachment.html>
More information about the CMake
mailing list