Commit d8a696c3 authored by Stephanos Ioannidis's avatar Stephanos Ioannidis
Browse files

lib: cpp: Enable POSIX and GNU C extensions for libc++

LLVM C++ Standard Library aka. libc++ makes use of POSIX and GNU C
extensions in its headers.

While far from ideal, there is no other option but to globally enable these
extensions for C++ source files in order to ensure that libc++ headers can
be used.

Signed-off-by: default avatarStephanos Ioannidis <root@stephanos.io>
parent 0ec0a7b9
Loading
Loading
Loading
Loading
+8 −0
Changes for lib/cpp/CMakeLists.txt: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
# SPDX-License-Identifier: Apache-2.0

if(CONFIG_LIBCXX_LIBCPP)
  # LLVM C++ Standard Library makes use of POSIX and GNU C extension functions
  # in its headers.
  zephyr_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:_POSIX_C_SOURCE=200809L>)
  zephyr_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:_XOPEN_SOURCE=700>)
  zephyr_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:_GNU_SOURCE>)
endif()

add_subdirectory(abi)

add_subdirectory_ifdef(CONFIG_MINIMAL_LIBCPP minimal)