# DEPRECATION "The CMAKE\_FORCE\_C\_COMPILER " clarification

**URL:** https://discourse.cmake.org/t/deprecation-the-cmake-force-c-compiler-clarification/2814
**Category:** Code
**Tags:** os:windows, gen:makefiles
**Created:** [February 23, 2021, 7:35am UTC](https://discourse.cmake.org/t/deprecation-the-cmake-force-c-compiler-clarification/2814 "2021-02-23T07:35:13Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![udayakarthik\_g](https://discourse.cmake.org/user_avatar/discourse.cmake.org/udayakarthik_g/32/1226_2.png) [@udayakarthik\_g](https://discourse.cmake.org/u/udayakarthik_g)
#### Post date: [February 23, 2021, 7:35am UTC](https://discourse.cmake.org/t/deprecation-the-cmake-force-c-compiler-clarification/2814/1 "2021-02-23T07:35:13Z")

</div>

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”)

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 23, 2021, 6:59pm UTC](https://discourse.cmake.org/t/deprecation-the-cmake-force-c-compiler-clarification/2814/2 "2021-02-23T18:59:07Z")

</div>

You should use [a toolchain file](https://cmake.org/cmake/help/v3.6/manual/cmake-toolchains.7.html) or pass `-DCMAKE_${LANG}_COMPILER=$path` on the command line. Projects should not set `CMAKE_${LANG}_COMPILER}` themselves.

[This Discourse thread](https://discourse.cmake.org/t/proper-way-to-set-compiler-and-language-standard-in-cmake/2756) is related.

---

<div class="post-metadata">

### Author: ![udayakarthik\_g](https://discourse.cmake.org/user_avatar/discourse.cmake.org/udayakarthik_g/32/1226_2.png) [@udayakarthik\_g](https://discourse.cmake.org/u/udayakarthik_g)
#### Post date: [February 25, 2021, 11:29am UTC](https://discourse.cmake.org/t/deprecation-the-cmake-force-c-compiler-clarification/2814/3 "2021-02-25T11:29:26Z")

</div>

How to avoid cmakeforce compliler .

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 25, 2021, 2:46pm UTC](https://discourse.cmake.org/t/deprecation-the-cmake-force-c-compiler-clarification/2814/4 "2021-02-25T14:46:42Z")

</div>

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.
