[CMake] Invoking an script from the link command.
Bill Hoffman
bill.hoffman at kitware.com
Thu Aug 14 10:55:50 EDT 2008
Óscar Fuentes wrote:
> Óscar Fuentes <ofv at wanadoo.es> writes:
>
>> Bill Hoffman <bill.hoffman at kitware.com>
>> writes:
>
> [about using shell backquotes embedded on link commands through
> `target_link_libraries']
>
>>> I don't even think this will work with cmake 2.6.0, because we use
>>> link scripts.
>> It is working with 2.6.1 and MSYS Makefiles. Here you are doing
>> something like this:
>>
>> cd ${CMAKE_CURRENT_BINARY_DIR} && /path/to/g++.exe ...args for linking...
>
> It doesn't work on Linux (Debian Etch x86) Unix Makefiles.
>
> Too bad CMake is not consistent on this. Not having the possibility of
> customising the command on make-time seems a serious limitation.
>
I think the best way for you to do this, is to override
CMAKE_CXX_LINK_EXECUTABLE in your project, and use a shell script to add
the extra stuff.
Something like this should work and be cross platform:
SET(CMAKE_CXX_LINK_EXECUTABLE "${YOUR_LINK_SCRIPT}
${CMAKE_CXX_LINK_EXECUTABLE}")
Where YOUR_LINK_SCRIPT is set to a script that takes the link line as
command line arguments and adds in the the output of your command.
-Bill
More information about the CMake
mailing list