diff --git a/cmake/app/boilerplate.cmake b/cmake/app/boilerplate.cmake index a7722cc4df8..0e04b6f6292 100644 --- a/cmake/app/boilerplate.cmake +++ b/cmake/app/boilerplate.cmake @@ -477,10 +477,6 @@ if(NOT DEFINED USER_CACHE_DIR) endif() message(STATUS "Cache files will be written to: ${USER_CACHE_DIR}") -# Prevent CMake from testing the toolchain -set(CMAKE_C_COMPILER_FORCED 1) -set(CMAKE_CXX_COMPILER_FORCED 1) - include(${ZEPHYR_BASE}/cmake/verify-toolchain.cmake) include(${ZEPHYR_BASE}/cmake/host-tools.cmake) diff --git a/cmake/generic_toolchain.cmake b/cmake/generic_toolchain.cmake index cea472c5a87..18894e0439d 100644 --- a/cmake/generic_toolchain.cmake +++ b/cmake/generic_toolchain.cmake @@ -1,5 +1,9 @@ # SPDX-License-Identifier: Apache-2.0 +# Prevent CMake from testing the toolchain +set(CMAKE_C_COMPILER_FORCED 1) +set(CMAKE_CXX_COMPILER_FORCED 1) + if(NOT TOOLCHAIN_ROOT) if(DEFINED ENV{TOOLCHAIN_ROOT}) # Support for out-of-tree toolchain diff --git a/cmake/target_toolchain.cmake b/cmake/target_toolchain.cmake index 0d8bbc2d32d..7ac1002e29b 100644 --- a/cmake/target_toolchain.cmake +++ b/cmake/target_toolchain.cmake @@ -1,5 +1,9 @@ # SPDX-License-Identifier: Apache-2.0 +# Prevent CMake from testing the toolchain +set(CMAKE_C_COMPILER_FORCED 1) +set(CMAKE_CXX_COMPILER_FORCED 1) + # No official documentation exists for the "Generic" value, except their wiki. # # https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/CrossCompiling: