zephyr/cmake/compiler/host-gcc/target.cmake
Ederson de Souza a0ee472a6f tests/misc: Add llext EDK test
This test uses pytest to generate an EDK from a simple Zephyr
application, and uses this EDK to build a simple extension, to ensure
that EDK generation is sane.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-05-17 16:21:48 +01:00

48 lines
1.2 KiB
CMake

# SPDX-License-Identifier: Apache-2.0
# Configures CMake for using GCC
find_program(CMAKE_C_COMPILER gcc)
if(CONFIG_CPP)
set(cplusplus_compiler g++)
else()
if(EXISTS g++)
set(cplusplus_compiler g++)
else()
# When the toolchain doesn't support C++, and we aren't building
# with C++ support just set it to something so CMake doesn't
# crash, it won't actually be called
set(cplusplus_compiler ${CMAKE_C_COMPILER})
endif()
endif()
find_program(CMAKE_CXX_COMPILER ${cplusplus_compiler} CACHE INTERNAL " " FORCE)
set(NOSTDINC "")
# Note that NOSYSDEF_CFLAG may be an empty string, and
# set_ifndef() does not work with empty string.
if(NOT DEFINED NOSYSDEF_CFLAG)
set(NOSYSDEF_CFLAG -undef)
endif()
foreach(file_name include/stddef.h)
execute_process(
COMMAND ${CMAKE_C_COMPILER} --print-file-name=${file_name}
OUTPUT_VARIABLE _OUTPUT
)
get_filename_component(_OUTPUT "${_OUTPUT}" DIRECTORY)
string(REGEX REPLACE "\n" "" _OUTPUT "${_OUTPUT}")
list(APPEND NOSTDINC ${_OUTPUT})
endforeach()
list(APPEND LLEXT_EDK_REMOVE_FLAGS
--sysroot=.*
-fmacro-prefix-map=.*
)
list(APPEND LLEXT_EDK_APPEND_FLAGS
-nodefaultlibs
)