# Chaging order of options in the link command of a cross-compilation project via CMAKE\_CXX\_LINK\_EXECUTABLE

**URL:** https://discourse.cmake.org/t/chaging-order-of-options-in-the-link-command-of-a-cross-compilation-project-via-cmake-cxx-link-executable/1346
**Category:** Usage
**Tags:** comp:ti
**Created:** [June 8, 2020, 2:07pm UTC](https://discourse.cmake.org/t/chaging-order-of-options-in-the-link-command-of-a-cross-compilation-project-via-cmake-cxx-link-executable/1346 "2020-06-08T14:07:57Z")
**Posts on this page:** 1
**Showing post:** 2

<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 10, 2020, 8:17pm UTC](https://discourse.cmake.org/t/chaging-order-of-options-in-the-link-command-of-a-cross-compilation-project-via-cmake-cxx-link-executable/1346/2 "2020-06-10T20:17:15Z")

</div>

I found this conversation: [CMAKE\_C\_LINK\_EXECUTABLE not considered for MINGW32](https://discourse.cmake.org/t/cmake-c-link-executable-not-considered-for-mingw32/254)

Looks like their suggestion there is to make a custom platform ID where I can populate the `CMAKE_C_LINK_EXECUTABLE`/`CMAKE_CXX_LINK_EXECUTABLE` which ever way I want. This makes me wonder if this is a deficiency in the implementation of [`Modules/Compiler/TI-CXX.cmake`](https://github.com/Kitware/CMake/blob/v3.5.1/Modules/Compiler/TI-CXX.cmake). Should it be checking if it’s defined before it `set()`'s the variable? e.g.

```cmake
if(NOT DEFINED CMAKE_C_LINK_EXECUTABLE)
    set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> --run_linker --output_file=<TARGET> --map_file=<TARGET>.map <CMAKE_CXX_LINK_FLAGS> <LINK_LIBRARIES> <LINK_FLAGS> <OBJECTS>")
endif()
```

---

_[View the full topic](https://discourse.cmake.org/t/chaging-order-of-options-in-the-link-command-of-a-cross-compilation-project-via-cmake-cxx-link-executable/1346)._
