Skip to content

Commit 0217c39

Browse files
Chris Friedtfabiobaltieri
authored andcommitted
posix: conditionally compile perror pthread_common and nanosleep
Previously, these files were compiled unconditionally. Partial fix for #50654 Signed-off-by: Chris Friedt <[email protected]>
1 parent 715478f commit 0217c39

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/posix/CMakeLists.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ if(CONFIG_POSIX_API)
88
endif()
99

1010
zephyr_library()
11-
zephyr_library_sources(perror.c)
12-
zephyr_library_sources(pthread_common.c)
11+
zephyr_library_sources_ifdef(CONFIG_POSIX_API perror.c)
12+
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread_common.c)
1313
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread_cond.c)
1414
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread_mutex.c)
1515
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread_barrier.c)
1616
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread.c)
1717
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread_sched.c)
1818
zephyr_library_sources_ifdef(CONFIG_POSIX_CLOCK clock.c)
19+
zephyr_library_sources_ifdef(CONFIG_POSIX_CLOCK nanosleep.c)
1920
zephyr_library_sources_ifdef(CONFIG_POSIX_CLOCK sleep.c)
2021
zephyr_library_sources_ifdef(CONFIG_POSIX_CLOCK timer.c)
2122
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread_rwlock.c)
@@ -26,13 +27,10 @@ zephyr_library_sources_ifdef(CONFIG_POSIX_FS fs.c)
2627
zephyr_library_sources_ifdef(CONFIG_EVENTFD eventfd.c)
2728
add_subdirectory_ifdef(CONFIG_GETOPT getopt)
2829

29-
if(NOT (CONFIG_BOARD_NATIVE_POSIX OR CONFIG_BOARD_NATIVE_POSIX_64BIT))
30-
zephyr_library_sources(nanosleep.c)
31-
endif()
32-
3330
zephyr_library_include_directories(
3431
${ZEPHYR_BASE}/kernel/include
3532
${ARCH_DIR}/${ARCH}/include
3633
)
3734

3835
zephyr_library_link_libraries(posix_subsys)
36+
zephyr_library_property(ALLOW_EMPTY TRUE)

0 commit comments

Comments
 (0)