Skip to content

Commit 2e8d4fe

Browse files
committed
CMake: ninja reponse files disabled for ARMClang on Windows
Issue https://gitlab.kitware.com/cmake/cmake/-/issues/21093 Until this is fixed, we should disable response files for ARMClang + ninja on Windows. Other toolchains and host systems should benefit from response files thus not disabling them completely. This fixes the issue with not finding includes. It's not trivial to find the root cause, it took me a while to figure out why ARMClang can't find the paths. I moved the check to Mbed OS main cmake. It should not be in the toolchain file as it is not related to the toolchain but to generator. We need toolchain properly set up first.
1 parent a7df684 commit 2e8d4fe

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,14 @@ function(mbed_generate_executable target)
185185
mbed_generate_bin_hex(${target})
186186
mbed_generate_map_file(${target})
187187
endfunction()
188+
189+
# Ninja requires to be forced for response files
190+
if ("${CMAKE_GENERATOR}" MATCHES "Ninja")
191+
# known issue ARMClang and Ninja with response files for windows
192+
# https://gitlab.kitware.com/cmake/cmake/-/issues/21093
193+
set(ninja_response_enable 1)
194+
if (CMAKE_HOST_SYSTEM_NAME MATCHES "Windows" AND CMAKE_CXX_COMPILER_ID MATCHES "ARMClang")
195+
set(ninja_response_enable 0)
196+
endif()
197+
set(CMAKE_NINJA_FORCE_RESPONSE_FILE ${ninja_response_enable} CACHE INTERNAL "")
198+
endif()

tools/cmake/toolchain.cmake

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,3 @@ set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1)
8989
set(CMAKE_ASM_USE_RESPONSE_FILE_FOR_LIBRARIES 1)
9090
set(CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES 1)
9191
set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_LIBRARIES 1)
92-
93-
# Ninja requires to be forced for response files
94-
if ("${CMAKE_GENERATOR}" MATCHES "Ninja")
95-
set(CMAKE_NINJA_FORCE_RESPONSE_FILE 1 CACHE INTERNAL "")
96-
endif()
97-

0 commit comments

Comments
 (0)