toxcore/testing/CMakeLists.txt
iphydf 766e62bc89
chore: Use pkg_search_module directly in cmake.
The `pkg_use_module` was doing magic we used to use, but no longer need.
2023-12-26 01:14:50 +00:00

31 lines
1.1 KiB
CMake

# 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})
if(TARGET toxcore_static)
target_link_libraries(misc_tools PRIVATE toxcore_static)
else()
target_link_libraries(misc_tools PRIVATE toxcore_shared)
endif()
target_link_libraries(misc_tools PRIVATE ${LIBSODIUM_LIBRARIES})
target_link_directories(misc_tools PUBLIC ${LIBSODIUM_LIBRARY_DIRS})
target_include_directories(misc_tools SYSTEM PRIVATE ${LIBSODIUM_INCLUDE_DIRS})
target_compile_options(misc_tools PRIVATE ${LIBSODIUM_CFLAGS_OTHER})
################################################################################
#
# :: Test programs
#
################################################################################
if(BUILD_MISC_TESTS)
add_executable(Messenger_test Messenger_test.c)
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()
endif()