I'm trying to build a library for CLang compiler with CMake. I now need to pass it some linker variables. I'm looking at an example which was done for some other architecture and I see the person who wrote that used a variable named 'CMAKE_C_LINK_EXECUTABLE' like this:
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> --run_linker <OBJECTS>
<CMAKE_C_LINK_FLAGS> <LINK_FLAGS> --map_file=<TARGET>.map
--output_file=<TARGET> <LINK_LIBRARIES>")
Now I suppose that in order to add linker options I need to append the flags to the 'CMAKE_C_LINK_FLAGS' variable before I set the 'CMAKE_C_LINK_EXECUTABLE' variable. Something like this:
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS } --myFlag")
Please tell me if that's the proper way to set linker options. Also I have searched around for the 'CMAKE_C_LINK_EXECUTABLE' variable but I did not quite understand what it does. Can you please explain to me how this variable is used? Thank you for reading!