Skip to content

Commit 93f0d0d

Browse files
tejlmandnashif
authored andcommitted
armclang: warn on non-Ninja generator for CMake 3.20.
When using ARMClang linker and scatter files (armlink) then all libraries are linked as object libraries using `$<TARGET_OBJECTS:lib>`. CMake version 3.20 only has limited support for such linking: > Referencing $<TARGET_OBJECTS> in target_link_libraries calls worked > in versions of CMake prior to 3.21 for some cases, but was not fully > supported. One of those cases that do not work is Unix Makefiles generators. As only Ninja is currently verified to work, this commit will check the CMake version in use and the generator, and if CMake version <=3.21 is used with non-Ninja generator then an error is raised informing user to either use Ninja generator or update CMake. As the Ninja generator has been confirmed to work as expected, then that generator is accepted with CMake 3.20 and older. Signed-off-by: Torsten Rasmussen <[email protected]>
1 parent 40a2ffd commit 93f0d0d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmake/toolchain/armclang/generic.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ set_ifndef(ARMCLANG_TOOLCHAIN_PATH "$ENV{ARMCLANG_TOOLCHAIN_PATH}")
44
set(ARMCLANG_TOOLCHAIN_PATH ${ARMCLANG_TOOLCHAIN_PATH} CACHE PATH "armclang tools install directory")
55
assert(ARMCLANG_TOOLCHAIN_PATH "ARMCLANG_TOOLCHAIN_PATH is not set")
66

7+
if(${CMAKE_VERSION} VERSION_LESS 3.21
8+
AND NOT ${CMAKE_GENERATOR} STREQUAL Ninja
9+
)
10+
message(FATAL_ERROR "ARMClang Toolchain and '${CMAKE_GENERATOR}' generator "
11+
"doesn't work properly for target object files on CMake version: "
12+
"${CMAKE_VERSION}. Use the 'Ninja' generator or update to CMake >= 3.21."
13+
)
14+
endif()
15+
716
if(NOT EXISTS ${ARMCLANG_TOOLCHAIN_PATH})
817
message(FATAL_ERROR "Nothing found at ARMCLANG_TOOLCHAIN_PATH: '${ARMCLANG_TOOLCHAIN_PATH}'")
918
endif()

0 commit comments

Comments
 (0)