Skip to content

Commit 9509789

Browse files
stephanosiokeith-packard
authored andcommitted
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: Stephanos Ioannidis <root@stephanos.io>
1 parent 5bf489d commit 9509789

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/cpp/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3+
if(CONFIG_LIBCXX_LIBCPP)
4+
# LLVM C++ Standard Library makes use of POSIX and GNU C extension functions
5+
# in its headers.
6+
zephyr_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:_POSIX_C_SOURCE=200809L>)
7+
zephyr_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:_XOPEN_SOURCE=700>)
8+
zephyr_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:_GNU_SOURCE>)
9+
endif()
10+
311
add_subdirectory(abi)
412

513
add_subdirectory_ifdef(CONFIG_MINIMAL_LIBCPP minimal)

0 commit comments

Comments
 (0)