2023-07-25 11:53:09 +02:00
|
|
|
# Helpful code for tests and other utilities
|
|
|
|
set(misc_tools_SOURCES
|
|
|
|
misc_tools.c
|
|
|
|
misc_tools.h)
|
|
|
|
add_library(misc_tools STATIC ${misc_tools_SOURCES})
|
2023-12-27 12:37:22 +01:00
|
|
|
if(TARGET toxcore_static)
|
|
|
|
target_link_libraries(misc_tools PRIVATE toxcore_static)
|
|
|
|
else()
|
|
|
|
target_link_libraries(misc_tools PRIVATE toxcore_shared)
|
|
|
|
endif()
|
2024-12-19 16:27:40 +01:00
|
|
|
if(TARGET pthreads4w::pthreads4w)
|
|
|
|
target_link_libraries(misc_tools PRIVATE pthreads4w::pthreads4w)
|
|
|
|
elseif(TARGET PThreads4W::PThreads4W)
|
2024-01-09 16:39:05 +01:00
|
|
|
target_link_libraries(misc_tools PRIVATE PThreads4W::PThreads4W)
|
|
|
|
elseif(TARGET Threads::Threads)
|
|
|
|
target_link_libraries(misc_tools PRIVATE Threads::Threads)
|
|
|
|
endif()
|
2023-07-25 11:53:09 +02:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# :: Test programs
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
2023-12-27 12:37:22 +01:00
|
|
|
if(BUILD_MISC_TESTS)
|
2023-07-25 11:53:09 +02:00
|
|
|
add_executable(Messenger_test Messenger_test.c)
|
2023-12-27 12:37:22 +01:00
|
|
|
target_link_libraries(Messenger_test PRIVATE misc_tools)
|
|
|
|
if(TARGET toxcore_static)
|
|
|
|
target_link_libraries(Messenger_test PRIVATE toxcore_static)
|
|
|
|
else()
|
|
|
|
target_link_libraries(Messenger_test PRIVATE toxcore_shared)
|
|
|
|
endif()
|
2024-12-19 16:27:40 +01:00
|
|
|
if(TARGET pthreads4w::pthreads4w)
|
|
|
|
target_link_libraries(Messenger_test PRIVATE pthreads4w::pthreads4w)
|
|
|
|
elseif(TARGET PThreads4W::PThreads4W)
|
2024-01-09 16:39:05 +01:00
|
|
|
target_link_libraries(Messenger_test PRIVATE PThreads4W::PThreads4W)
|
|
|
|
elseif(TARGET Threads::Threads)
|
|
|
|
target_link_libraries(Messenger_test PRIVATE Threads::Threads)
|
|
|
|
endif()
|
2023-07-25 11:53:09 +02:00
|
|
|
endif()
|