ARMClang: CMAKE_LIBRARY_PATH_FLAG set to default "-L" even when using armlink
My project which uses ARMClang 6.6 doesn't build with CMake versions 3.15 and above. After investigating the problem, I found that there are several reasons which are all related to MR !3315 (merged) . My first problem is already addressed by #19962 (closed) so I will not mention the details here.
My second problem is that the variable CMAKE_LIBRARY_PATH_FLAG
takes it's value from CMakeGenericSystem.cmake
which is -L
. this would be fine if the value of <CMAKE_LINKER>
is set to armclang
since this is used by CMAKE_${lang}_LINK_EXECUTABLE
to perform the linking step. However when <CMAKE_LINKER>
is set to armlink
you get an error since the linker doesn't recognize the -L
flag, instead this flag shall be set to --userlibpath=
. This is mentioned in the documentation of armclang
armclang translates this option to --userlibpath and passes it to armlink
When I tried setting <CMAKE_LINKER>
to armclang
it didn't work because other armlink specific flags are not recognized by armclang. e.g. --list
and --via
which must be preceded by -Xlinker
(doc) or -Wl
(doc) so that armclang passes them correctly to the linker.
fixing this conflict from a toolchain file is not possible since this macro overrides the variables CMAKE_${lang}_LINK_EXECUTABLE
and CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG
upon calling project()
as mentioned in #17880 (closed) so I think this can only be fixed in ARMClang.cmake