tomato-testing/external/toxcore/CMakeLists.txt

67 lines
1.7 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.9...3.16 FATAL_ERROR)
2023-07-25 01:11:30 +02:00
set(EXPERIMENTAL_API ON CACHE BOOL "" FORCE)
set(UNITTEST OFF CACHE BOOL "" FORCE)
set(BOOTSTRAP_DAEMON OFF CACHE BOOL "" FORCE)
2023-07-25 01:11:30 +02:00
add_subdirectory(./c-toxcore)
2023-07-25 01:11:30 +02:00
# the ideal case
#add_library(toxcore ALIAS toxcore_static)
2023-07-25 01:11:30 +02:00
# the sad case
add_library(toxcore INTERFACE)
2024-04-27 13:56:06 +02:00
if (TARGET toxcore_static)
target_link_libraries(toxcore INTERFACE toxcore_static)
else()
target_link_libraries(toxcore INTERFACE toxcore_shared)
endif()
2023-07-25 01:11:30 +02:00
# HACK: "install" api headers into binary dir
configure_file(
./c-toxcore/toxcore/tox.h
${CMAKE_CURRENT_BINARY_DIR}/include/tox/tox.h
@ONLY
)
2023-07-25 01:11:30 +02:00
configure_file(
./c-toxcore/toxcore/tox_events.h
${CMAKE_CURRENT_BINARY_DIR}/include/tox/tox_events.h
2023-07-25 01:11:30 +02:00
@ONLY
)
configure_file(
./c-toxcore/toxcore/tox_private.h
${CMAKE_CURRENT_BINARY_DIR}/include/tox/tox_private.h
2023-07-25 01:11:30 +02:00
@ONLY
)
2023-11-13 13:24:48 +01:00
configure_file(
./c-toxcore/toxencryptsave/toxencryptsave.h
${CMAKE_CURRENT_BINARY_DIR}/include/tox/toxencryptsave.h
@ONLY
)
configure_file(
./c-toxcore/toxav/toxav.h
${CMAKE_CURRENT_BINARY_DIR}/include/tox/toxav.h
2023-11-13 13:24:48 +01:00
@ONLY
)
2023-07-25 01:11:30 +02:00
target_include_directories(toxcore INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/include/)
2023-07-25 01:11:30 +02:00
# HACK: support old libsodium find
# libs should handle this case themselfs
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
2023-07-25 01:11:30 +02:00
find_package(sodium QUIET)
if(unofficial-sodium_FOUND) # vcpkg
2023-07-25 15:09:56 +02:00
if(TARGET unofficial-sodium::sodium)
target_link_libraries(toxcore INTERFACE unofficial-sodium::sodium)
2023-07-25 15:09:56 +02:00
endif()
if(TARGET unofficial-sodium::sodium_config_public)
target_link_libraries(toxcore INTERFACE unofficial-sodium::sodium_config_public)
2023-07-25 15:09:56 +02:00
endif()
2023-07-25 01:11:30 +02:00
elseif(sodium_FOUND)
target_link_libraries(toxcore INTERFACE sodium)
2023-07-25 01:11:30 +02:00
else()
message(SEND_ERROR "missing libsodium")
endif()