From de34b67c459a7410813aac6b3ed4eb50af3e9bcc Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Thu, 16 Dec 2021 10:05:20 +0100 Subject: [PATCH] cmake: move CMAKE__COMPILER_FORCED into toolchain code. To prepare for more modular approach move the compiler forced out of boilerplate and into the specific toolchain cmake code (generic/target). Code is added to both generic and target toolchain modules to allow future use of one module without requiring a load of the other module. Signed-off-by: Torsten Rasmussen --- cmake/app/boilerplate.cmake | 4 ---- cmake/generic_toolchain.cmake | 4 ++++ cmake/target_toolchain.cmake | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) 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: