diff --git a/CMakeLists.txt b/CMakeLists.txt index b7fb6f61c0..59ec716b38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -200,3 +200,12 @@ function(mbed_generate_executable target) mbed_generate_bin_hex(${target}) mbed_generate_map_file(${target}) endfunction() + +# Ninja requires to be forced for response files +if ("${CMAKE_GENERATOR}" MATCHES "Ninja") + # known issue ARMClang and Ninja with response files for windows + # https://gitlab.kitware.com/cmake/cmake/-/issues/21093 + if(NOT (CMAKE_HOST_SYSTEM_NAME MATCHES "Windows" AND CMAKE_CXX_COMPILER_ID MATCHES "ARMClang")) + set(CMAKE_NINJA_FORCE_RESPONSE_FILE 1 CACHE INTERNAL "") + endif() +endif() diff --git a/tools/cmake/toolchain.cmake b/tools/cmake/toolchain.cmake index 50dbeda600..6f11d7a854 100644 --- a/tools/cmake/toolchain.cmake +++ b/tools/cmake/toolchain.cmake @@ -89,9 +89,3 @@ set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1) set(CMAKE_ASM_USE_RESPONSE_FILE_FOR_LIBRARIES 1) set(CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES 1) set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_LIBRARIES 1) - -# Ninja requires to be forced for response files -if ("${CMAKE_GENERATOR}" MATCHES "Ninja") - set(CMAKE_NINJA_FORCE_RESPONSE_FILE 1 CACHE INTERNAL "") -endif() -