DEPRECATION "The CMAKE_FORCE_C_COMPILER " clarification

Hello Sir/Madam,
We are using Cmake compiler version 3.12.0. I am using the below cmake script for compilation. While I am compiling the code I got a warning like " message(DEPRECATION “The CMAKE_FORCE_C_COMPILER macro is deprecated. " “Instead, just set CMAKE_C_COMPILER and allow CMAKE to identify the compiler.”)” .

May I know how to fix this issue. we are using Rh850 based compiler and windows10 machine. Let me know if any other information is required from my side.

Cmake Script cmd:

Change Compiler to RH850

set(CMAKE_C_COMPILER “${COMPILER_PATH}/ccv850.exe”)
set(CMAKE_CXX_COMPILER “${COMPILER_PATH}/cxv850.exe”)

#TODO set dependency files (.d) to the correct location for compiler id check and remove FORCE’s
CMAKE_FORCE_C_COMPILER("${COMPILER_PATH}/ccv850.exe" “ARM”)
CMAKE_FORCE_CXX_COMPILER("${COMPILER_PATH}/cxv850.exe" “ARM”)

You should use a toolchain file or pass -DCMAKE_${LANG}_COMPILER=$path on the command line. Projects should not set CMAKE_${LANG}_COMPILER} themselves.

This Discourse thread is related.

How to avoid cmakeforce compliler .

Without more information, I would just remove any usage of the macro and add documentation about how to set the compiler to the build instructions.