Skip to content

Commit 20c35cd

Browse files
committed
fix macos build
1 parent c4e55ef commit 20c35cd

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@ target_include_directories(slick_shm INTERFACE
2323
target_compile_features(slick_shm INTERFACE cxx_std_17)
2424

2525
# Platform-specific linking
26-
if(WIN32)
27-
# No special libraries needed on Windows
28-
elseif(UNIX)
29-
# Link with rt (realtime) for shm_open/shm_unlink on POSIX systems
26+
if(APPLE)
27+
# macOS doesn't need rt library (shm_open/shm_unlink are in libc)
3028
# pthread may be needed for some implementations
29+
find_package(Threads)
30+
if(Threads_FOUND)
31+
target_link_libraries(slick_shm INTERFACE Threads::Threads)
32+
endif()
33+
elseif(UNIX)
34+
# Linux needs rt (realtime) for shm_open/shm_unlink
3135
target_link_libraries(slick_shm INTERFACE rt)
3236

33-
# On some systems (older Linux), pthread is also needed
37+
# pthread may be needed for some implementations
3438
find_package(Threads)
3539
if(Threads_FOUND)
3640
target_link_libraries(slick_shm INTERFACE Threads::Threads)

0 commit comments

Comments
 (0)