diff --git a/subsys/testsuite/ztest/CMakeLists.txt b/subsys/testsuite/ztest/CMakeLists.txt index 4d29ac033c..98b1cf1760 100644 --- a/subsys/testsuite/ztest/CMakeLists.txt +++ b/subsys/testsuite/ztest/CMakeLists.txt @@ -15,6 +15,10 @@ if(DEFINED TC_RUNID) endif() zephyr_library() + +# For strtok_r() and strdup() +zephyr_library_compile_options(-D_POSIX_C_SOURCE=200809L) + zephyr_library_sources( src/ztest.c src/ztest_error_hook.c diff --git a/subsys/testsuite/ztest/src/ztest_posix.c b/subsys/testsuite/ztest/src/ztest_posix.c index 438e11a56d..744219538c 100644 --- a/subsys/testsuite/ztest/src/ztest_posix.c +++ b/subsys/testsuite/ztest/src/ztest_posix.c @@ -4,9 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -#undef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200809L - #include #include #include "cmdline.h" /* native_sim command line options header */