Skip to content

Commit 9faeadc

Browse files
0xc0170hugueskamba
andcommitted
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. Note, I had to protect setting CMAKE_NINJA_FORCE_RESPONSE_FILE. If I set it to 0, ninja would still use rsp files so I rather protected it and define that variable only when required, not always. Co-authored-by: Hugues Kamba <[email protected]>
1 parent bf552af commit 9faeadc

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,12 @@ function(mbed_generate_executable target)
200200
mbed_generate_bin_hex(${target})
201201
mbed_generate_map_file(${target})
202202
endfunction()
203+
204+
# Ninja requires to be forced for response files
205+
if ("${CMAKE_GENERATOR}" MATCHES "Ninja")
206+
# known issue ARMClang and Ninja with response files for windows
207+
# https://gitlab.kitware.com/cmake/cmake/-/issues/21093
208+
if(NOT (CMAKE_HOST_SYSTEM_NAME MATCHES "Windows" AND CMAKE_CXX_COMPILER_ID MATCHES "ARMClang"))
209+
set(CMAKE_NINJA_FORCE_RESPONSE_FILE 1 CACHE INTERNAL "")
210+
endif()
211+
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)