<div dir="ltr">Hi folks,<div><br></div><div>my previous post, titled "Produce only an object file (*.o) from a CMake build target", in response to <a href="http://www.cmake.org/pipermail/cmake/2011-January/042284.html">an older post</a> did not go through correctly, so I will state my question again:</div>
<div><br></div><div>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:</div>
<div><br></div><div><div>set_target_properties(${TARGET} PROPERTIES RULE_LAUNCH_LINK</div><div>    "${CMAKE_CURRENT_SOURCE_DIR}/hijack.sh ${MY_CUSTOM_LINKER}"</div></div><div><br></div><div>where hijack.sh is:</div>
<div><br></div><div><div>#!/bin/sh</div><div>comp=$1  # save MY_CUSTOM_LINKER</div><div>shift 2        # skip the cmake-generated linker</div><div>for var in "$@"; do comp="$comp $var"; done # add rest of arguments</div>
<div>$comp       # link with MY_CUSTOM_LINKER</div></div><div><br></div><div>This works fine with make, but RULE_LAUNCH_LINK only works with Makefile generators.</div><div><br></div><div>Are there any plans supporting RULE_LAUNCH_LINK with ninja?</div>
<div><br></div><div>Is there another way to replace the linker executable for a single file?</div><div><br></div><div>Thanks,</div><div>Jozsef</div><div><br></div></div>