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

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:

# 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.

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.

I think the preferable approach for cross-compilers is to create a toolchain file.

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/17880

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 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.