I have a CMake toolchain file to cross-compile to a TI C2000 (C28x) MCU. The compilation seems to go well except during the link process I receive a couple of warnings, the relevant warning says
warning: Option -o is an alias of linker option --output_file. The specified argument of off is also a valid argument for the compiler option --opt_level (-o). If the intent is to specify the optimization level, the option should be specified before the --run_linker(-z) option. As specified, the output file of the linker will be off
Specifically the part
If the intent is to specify the optimization level, the option should be specified before the --run_linker(-z) option. As specified, the output file of the linker will be off"
My understanding is that if I want to change where the linker flags are placed in the command I have to modify
CMAKE_C_LINKER_EXECUTABLE, however setting this variable seems to have no effect. I’ve tried setting it on the command line, in the toolchain file and in the CMakeLists.txt.
The source code here specifies this variable as:
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> --run_linker --output_file=<TARGET> --map_file=<TARGET>.map <CMAKE_CXX_LINK_FLAGS> <LINK_LIBRARIES> <LINK_FLAGS> <OBJECTS>")
and I’d like to place
LINK_FLAGS before the
--run-linker command as suggested in the warning.
Any idea how I can override this?