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
-- 

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

Reply via email to