[CMake] extending CMAKE_<LANG>_LINK_EXECUTABLE
Setzer Sebastian (CM-CI2/ECS2)
Sebastian.Setzer at de.bosch.com
Tue Oct 8 09:08:50 EDT 2019
Dear list,
I need to run a tool after building an executable, which will modify the executable itself.
I intend to extend the toolchain for this, because it shall be done for every executable on this particular operating system.
I think for this purpose, I need to change the rule CMAKE_<LANG>_LINK_EXECUTABLE.
And I think I can't put multiple commands into that rule, so I need to write a wrapper which will be called instead of the normal linker, and the calls the normal linker and then that special tool.
Right, so far?
Now I'd like to pass a few additional parameters to this tool, which I'd like to get from a special target property.
The rule currently looks like this:
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
And I wonder what these placeholders in angle brackets mean, and if there are more placeholders available. The manual doesn't say anything about this, unfortunately:
https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_LINK_EXECUTABLE.html
Is there, for example, a way to access arbitrary target properties?
Or do I need to hide my special parameters somewhere in the LINK_OPTIONS property?
Regards,
Sebastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20191008/3ae1be69/attachment.html>
More information about the CMake
mailing list