diff --git a/scripts/cmake/misc.cmake b/scripts/cmake/misc.cmake index ee794780cd09..36976c119b9d 100644 --- a/scripts/cmake/misc.cmake +++ b/scripts/cmake/misc.cmake @@ -49,6 +49,12 @@ macro(is_zephyr ret) endif() endmacro() +macro(add_local_sources_ifdef condition target) + if(${condition}) + add_local_sources(${target} ${ARGN}) + endif() +endmacro() + # Adds sources to target like target_sources, but assumes that # paths are relative to subdirectory. # Works like: diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 621d9782f9cb..008d01650da9 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -128,6 +128,20 @@ macro(is_zephyr ret) endif() endmacro() +# Wrappers for re-using existing, XTOS CMake files. Do NOT use in Zephyr-specific code. +macro(add_local_sources target) + if (NOT "${target}" STREQUAL "sof") + message(FATAL_ERROR "add_local_sources() target is not 'sof'") + endif() + zephyr_library_sources(${ARGN}) +endmacro() +macro(add_local_sources_ifdef condition target) + if (NOT "${target}" STREQUAL "sof") + message(FATAL_ERROR "add_local_sources_ifdef() target is not 'sof'") + endif() + zephyr_library_sources_ifdef(${condition} ${ARGN}) +endmacro() + add_subdirectory(../src/init/ init_unused_install/) add_subdirectory(../src/ipc/ ipc_unused_install/)