1if (NOT TARGET pico_sync_headers)
2    add_library(pico_sync_headers INTERFACE)
3    target_link_libraries(pico_sync_headers INTERFACE
4            hardware_sync_headers
5            pico_time_headers)
6endif()
7
8if (NOT TARGET pico_sync)
9    pico_add_impl_library(pico_sync)
10    target_include_directories(pico_sync_headers INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
11    pico_mirrored_target_link_libraries(pico_sync INTERFACE pico_sync_sem pico_sync_mutex pico_sync_critical_section pico_time hardware_sync)
12endif()
13
14
15if (NOT TARGET pico_sync_core)
16    pico_add_library(pico_sync_core NOFLAG)
17    target_sources(pico_sync_core INTERFACE
18            ${CMAKE_CURRENT_LIST_DIR}/lock_core.c
19    )
20endif()
21
22if (NOT TARGET pico_sync_sem)
23    pico_add_library(pico_sync_sem)
24    target_sources(pico_sync_sem INTERFACE
25        ${CMAKE_CURRENT_LIST_DIR}/sem.c
26    )
27    pico_mirrored_target_link_libraries(pico_sync_sem INTERFACE pico_sync_core)
28endif()
29
30if (NOT TARGET pico_sync_mutex)
31    pico_add_library(pico_sync_mutex)
32    target_sources(pico_sync_mutex INTERFACE
33            ${CMAKE_CURRENT_LIST_DIR}/mutex.c
34            )
35    pico_mirrored_target_link_libraries(pico_sync_mutex INTERFACE pico_sync_core)
36endif()
37
38if (NOT TARGET pico_sync_critical_section)
39    pico_add_library(pico_sync_critical_section)
40    target_sources(pico_sync_critical_section INTERFACE
41            ${CMAKE_CURRENT_LIST_DIR}/critical_section.c
42            )
43    pico_mirrored_target_link_libraries(pico_sync_critical_section INTERFACE pico_sync_core)
44endif()
45
46
47