I managed to cross compile with the ccrx v3.06 using ninja and cmake v4.0.2.
I would like to go multi-config BUT a define (CMAKE_INTDIR) is added under the hood.
The problem is that the ccrx accepts defines as -define=NAME=VALUE not -DNAME=VALUE.
I had a look at the cmake source code and I can see that in file cmNinjaTargetGenerator.cxx,
at line 311 there is the following code:
// Seriously??
if (this->GetGlobalGenerator()->IsMultiConfig()) {
defines.insert(cmStrCat("CMAKE_INTDIR=\"", config, '"'));
}
The define is hard coded and pushed to the impl-<CONFIG>.ninja file in the DEFINES = line.
From cmake, I tried with remove_definitions("-DCMAKE_INTDIR=\"Debug\"") with no success.
I had a look at the cmake debugger, but I could not find anything related to CMAKE_INTDIR.
My question is: what should I do?
I considered compiling cmake by myself but I am not sure it is worth.
That line is correct, that is how to add a global define to the cflags of a generator.
The problem is it’s being serialized incorrectly, ie we’re not settings the CMAKE_CXX_DEFINE_FLAG correctly for ccrx and thus it’s being prefixed with -D instead of -define. I think this is just a straight up bug in our support for Renesas but I don’t have a Renesas compiler to test it out.
Modules/Compiler/Renesas.cmake does try to set this correctly:
macro(__compiler_renesas lang)
if(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID STREQUAL "RX")
# CC-RX
# Pass directly include and define flag to the assembler.
if ("${lang}" STREQUAL "ASM")
set(_ASM_PREFIX "-asmopt=")
endif()
set(CMAKE_INCLUDE_FLAG_${lang} "${_ASM_PREFIX}-include=")
set(CMAKE_${lang}_DEFINE_FLAG "${_ASM_PREFIX}-define=")
So something else is going on here. Do any compile-definitions work correctly in your setup?