zephyr/cmake
Daniel DeGrasse 0ea212918f cmake: extensions: use INTERFACE_SOURCES as property for code relocation
In order to enable code relocation, we use a custom target
(code_data_relocation_target), and add files we wish to relocate, as
well as which sections should be relocated to the COMPILE_DEFINITIONS
property for the target.

This approach has been fragile, because COMPILE_DEFINITIONS can also be
added to for all targets using `add_definitions`. This means if another
part of the project uses `add_definitions` and
CONFIG_CODE_DATA_RELOCATION is on, a warning will appear about the
"file" not being found. The "file" of course, is just the definition
added by `add_definitions`.

To work around this, switch to overloading the INTERFACE_SOURCES
property. This property should be a bit more robust, because nobody else
will add sources to the code_data_relocation_target.

However, this approach has the downside that the CMake documentation
pstates targets created with `add_custom_target()` (which the
code_data_relocation_target is) do not have an INTERFACE scope for
their sources- so while this approach works, it is not officially
supported by CMake

Fixes #60220

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-11-16 13:35:36 -05:00
..
app
bintools cmake: Adjust LMA for user-specified sections 2024-08-12 15:53:42 +02:00
compiler cmake: toolchain/xcc,xt-clang: env vars for multiple cores 2024-10-31 09:26:00 -05:00
emu cmake: emu: qemu: return to ctrl-c 2024-10-03 17:08:14 +01:00
flash cmake: flash: Update OPENOCD variables to work with sysbuild 2024-10-11 13:15:56 -04:00
ide build: namespace `autoconf.h` with `zephyr/` 2024-05-28 22:03:55 +02:00
linker cmake: extensions: use INTERFACE_SOURCES as property for code relocation 2024-11-16 13:35:36 -05:00
linker_script arch: common: fix copy for ramfunc region during XIP init 2024-11-06 10:19:08 -08:00
makefile_exports
modules cmake: extensions: use INTERFACE_SOURCES as property for code relocation 2024-11-16 13:35:36 -05:00
reports reports: footprint: Print footprint output 2024-10-25 22:44:07 +01:00
sca cmake: sca: codechecker: Add cleanup step 2024-09-12 10:04:05 +02:00
toolchain cmake: toolchain/xcc,xt-clang: env vars for multiple cores 2024-10-31 09:26:00 -05:00
usage cmake: targets: usage: add missing custom targets 2024-08-31 06:46:44 -04:00
util
cfb.cmake
extra_flags.cmake
gcc-m-cpu.cmake arch: Add Cortex-R8 support 2024-10-01 09:58:22 +02:00
gcc-m-fpu.cmake arch: Add Cortex-R8 support 2024-10-01 09:58:22 +02:00
gen_version_h.cmake cmake: Create git module 2024-09-12 10:04:05 +02:00
hex.cmake
kobj.cmake build: namespace the generated headers with `zephyr/` 2024-05-28 22:03:55 +02:00
llext-edk.cmake llext-edk: fix: add compile definitions to the generated EDK 2024-08-12 12:43:09 +02:00
mcuboot.cmake mcuboot: Add support for RAM load mode 2024-10-11 13:19:39 -04:00
package_helper.cmake cmake: move script mode handling from package helper to extensions.cmake 2024-10-08 17:00:30 +02:00
pristine.cmake
target_toolchain_flags.cmake cmake: improve Zephyr link phase 2024-10-04 16:34:35 +01:00
verify-toolchain.cmake
vif.cmake