# Modifying CMAKE\_\<LANG\>\_LINK\_EXECUTABLE in toolchain file

**URL:** https://discourse.cmake.org/t/modifying-cmake-lang-link-executable-in-toolchain-file/1386
**Category:** Code
**Created:** [June 12, 2020, 9:28pm UTC](https://discourse.cmake.org/t/modifying-cmake-lang-link-executable-in-toolchain-file/1386 "2020-06-12T21:28:47Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![jairo](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jairo/32/672_2.png) [@jairo](https://discourse.cmake.org/u/jairo)
#### Post date: [June 19, 2020, 1:47pm UTC](https://discourse.cmake.org/t/modifying-cmake-lang-link-executable-in-toolchain-file/1386/4 "2020-06-19T13:47:19Z")

</div>

I have found a fix to my problem. It was actually much easier than I was making it out to be. The variable `CMAKE_<LANG>_LINK_EXECUTABLE` does not _need_ to be defined before calling `project()` as I was attempting to do by defining it as a `Platform/` or in the toolchain file. It can actually be defined in the `CMakeLists.txt` file, _after_ the call to `project()`.

Defining this rule variable before the call to `project()` might be possible in a `Platform/` file or some other way, but I had no luck with that approach.

---

_[View the full topic](https://discourse.cmake.org/t/modifying-cmake-lang-link-executable-in-toolchain-file/1386)._
