IAR: No extension specified for linker objects list file
CMake creates list of objects in CMakeFiles/App.dir/objects1
and uses it in link.txt
with no extension like
xlink.exe -f CMakeFiles\App.dir\objects1
Error
Error[e12]: Unable to open file 'CMakeFiles\App.dir\objects1'
Cause
From xlink.ENU.pdf
Syntax -f file
Description Use this option to extend the XLINK command line by reading arguments from a command file, just as if they were typed in on the command line. If not specified, an extension of xcl is assumed.
Adding xcl extension manually solves this problem.
Temporary solution
add_custom_command(
TARGET ${PROJECT_NAME}
PRE_LINK
COMMAND cp "${CMAKE_BINARY_DIR}/CMakeFiles/$<TARGET_NAME:${PROJECT_NAME}>.dir/objects1" "${CMAKE_BINARY_DIR}/CMakeFiles/$<TARGET_NAME:${PROJECT_NAME}>.dir/objects1.xcl"
COMMENT " Create objects list for xlink "
)
Setup
IAR Universal Linker V6.4.6.89
cmake version 3.25.0-rc4
Windows 11
Major Minor Build Revision
----- ----- ----- --------
10 0 22000 0
GNU Make 4.2
Built for x86_64-w64-mingw32
Edited by kossnikita