# Replace default compiler option (-o, -c, etc..) with CCRX-supported options (-output,…)

**URL:** <https://discourse.cmake.org/t/replace-default-compiler-option-o-c-etc-with-ccrx-supported-options-output/2004>\
**Category:** Code\
**Created:** [October 15, 2020, 9:10am UTC](https://discourse.cmake.org/t/replace-default-compiler-option-o-c-etc-with-ccrx-supported-options-output/2004 "2020-10-15T09:10:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xuan97z1](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/x/858c86/32.png) [@xuan97z1](https://discourse.cmake.org/u/xuan97z1)\
**Post date:** [October 15, 2020, 9:10am UTC](https://discourse.cmake.org/t/replace-default-compiler-option-o-c-etc-with-ccrx-supported-options-output/2004/1 "2020-10-15T09:10:27Z")

</div>

Hi,

I am working on a Renesas CCRX-based CMakeLists.txt for AmazonFreeRTOS project. However, I ran into the following error when I did a ‘make all’:

> E0511108:The “-o” option is not recognized.  
> E0511134:Input file “CMakeFiles/afr\_kernel.dir/freertos\_kernel/event\_groups.c.obj” is not found.  
> E0511108:The “-c” option is not recognized.  
> CMakeFiles/afr\_kernel.dir/build.make:81: recipe for target ‘CMakeFiles/afr\_kernel.dir/freertos\_kernel/event\_groups.c.obj’ failed  
> make[2]: \*\*\* [CMakeFiles/afr\_kernel.dir/freertos\_kernel/event\_groups.c.obj] Error 1  
> CMakeFiles/Makefile2:966: recipe for target ‘CMakeFiles/afr\_kernel.dir/all’ failed  
> make[1]: \*\*\* [CMakeFiles/afr\_kernel.dir/all] Error 2  
> Makefile:102: recipe for target ‘all’ failed  
> make: \*\*\* [all] Error 2

As indicated in the error message, -o and -c options are not recognized because they are not CCRX options (GNU option maybe?)

These options are not included in my CMakeLists compile option:

```auto
# This is a snippet from vendors\renesas\boards\rx_mcu_boards\rx65n-rsk\CMakeLists.txt

set(compiler_flags -isa=rxv2 -fpu -utf8 -branch=32 -nomessage=11174,21644,20010,23034,23035,20177,23033
-output=obj -debug -nologo)
    
# Compiler flags.
target_compile_options(
    AFR::compiler::mcu_port
    INTERFACE
        $<$<COMPILE_LANGUAGE:C>:${compiler_flags}>
)

```

so they must have been added by some AmazonFreeRTOS .cmake file in background.

My question is: How do I replace -o, -c options with CCRX-supported options (e.g: -output)?  
I manage to change C\_INCLUDE flag from “-I” to “-include”, but there doesn’t seem to be any information on changing other default flags.

Any assistance is appreciated.  
Thank you.

---

<div class="post-metadata">

**Author:** ![fdk17](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/f/ea666f/32.png) [@fdk17](https://discourse.cmake.org/u/fdk17)\
**Post date:** [October 15, 2020, 11:56am UTC](https://discourse.cmake.org/t/replace-default-compiler-option-o-c-etc-with-ccrx-supported-options-output/2004/2 "2020-10-15T11:56:33Z")

</div>

You’ll need to create your own `CMake` compiler module that sets these items. In the CMake installation you can see this done in `Modules/Compiler/TI.cmake` and related files for compilers identified as TI compilers.

Otherwise using `CMAKE_USER_MAKE_RULES_OVERRIDE` and override the rules after the fact should be feasible.

---

<div class="post-metadata">

**Author:** ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)\
**Post date:** [October 15, 2020, 1:26pm UTC](https://discourse.cmake.org/t/replace-default-compiler-option-o-c-etc-with-ccrx-supported-options-output/2004/3 "2020-10-15T13:26:16Z")

</div>

I think the preferable approach for cross-compilers is to create a [toolchain](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html) file.

---

<div class="post-metadata">

**Author:** ![fdk17](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/f/ea666f/32.png) [@fdk17](https://discourse.cmake.org/u/fdk17)\
**Post date:** [October 15, 2020, 1:59pm UTC](https://discourse.cmake.org/t/replace-default-compiler-option-o-c-etc-with-ccrx-supported-options-output/2004/4 "2020-10-15T13:59:55Z")

</div>

FYI, The kind of changes being asked about won’t necessarily work in a toolchain file.

[https://gitlab.kitware.com/cmake/cmake/-/issues/18713](https://gitlab.kitware.com/cmake/cmake/-/issues/18713)  
[https://gitlab.kitware.com/cmake/cmake/-/issues/17880](https://gitlab.kitware.com/cmake/cmake/-/issues/17880)

[https://gitlab.kitware.com/cmake/cmake/-/issues/17880#note\_397841](https://gitlab.kitware.com/cmake/cmake/-/issues/17880#note_397841)

> Toolchain files are not meant to have all settings for everything. They are only meant to have local information about the host machine, such as the path to the compiler. See [the docs](https://cmake.org/cmake/help/v3.11/manual/cmake-toolchains.7.html#cross-compiling-for-linux) for an example. Platform-wide information goes in platform modules named for the platform. There are projects out there that violate this and use all kinds of hacks to make a monolithic toolchain file work, but that approach is not supported by upstream.

> The settings in `CMakeGenericSystem` are defaults and can then be overridden by the `Platform/${CMAKE_SYSTEM_NAME}` module. If the settings in `Platform/Generic` don’t apply to your system then you need to create a `Platform/MySystem.cmake` module and set CMAKE\_SYSTEM\_NAME to `MySystem` , and put the module in `CMAKE_MODULE_PATH` .

> For further help please ask on a mailing list or other public forum with larger exposure. This is not a bug in CMake.
