From 48c294105f5123dc876fbad199ec1e0166d82a18 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Tue, 23 Dec 2025 11:59:45 +0100 Subject: build: Refactor CMake modules This moves the CMake build logic out of the source tree and splits it up into a more modular form. The tests now have a CMakeLists.txt file in their respective source directory. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- cmake/ipcp/udp.cmake | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 cmake/ipcp/udp.cmake (limited to 'cmake/ipcp/udp.cmake') diff --git a/cmake/ipcp/udp.cmake b/cmake/ipcp/udp.cmake new file mode 100644 index 00000000..7195dfa1 --- /dev/null +++ b/cmake/ipcp/udp.cmake @@ -0,0 +1,51 @@ +set(UDP_SOURCE_DIR "${IPCP_SOURCE_DIR}/udp") + +set(IPCP_UDP4_TARGET ipcpd-udp4 CACHE INTERNAL "") +set(IPCP_UDP6_TARGET ipcpd-udp6 CACHE INTERNAL "") + +set(IPCP_UDP_RD_THR 3 CACHE STRING + "Number of reader threads in UDP IPCPs") +set(IPCP_UDP_WR_THR 3 CACHE STRING + "Number of writer threads in UDP IPCPs") +set(IPCP_UDP_MPL 5000 CACHE STRING + "Default maximum packet lifetime for the UDP IPCPs, in ms") + +# Find nsupdate and nslookup for DDNS support +find_program(NSUPDATE_EXECUTABLE + NAMES nsupdate + DOC "The nsupdate tool that enables DDNS") + +find_program(NSLOOKUP_EXECUTABLE + NAMES nslookup + DOC "The nslookup tool that resolves DNS names") + +mark_as_advanced(NSLOOKUP_EXECUTABLE NSUPDATE_EXECUTABLE) + +if (NSLOOKUP_EXECUTABLE AND NSUPDATE_EXECUTABLE) + set(DISABLE_DDNS FALSE CACHE BOOL "Disable DDNS support") + if (NOT DISABLE_DDNS) + message(STATUS "DDNS support enabled") + set(HAVE_DDNS TRUE CACHE INTERNAL "") + else () + message(STATUS "DDNS support disabled by user") + unset(HAVE_DDNS CACHE) + endif () +else () + if (NSLOOKUP_EXECUTABLE) + message(STATUS "Install nsupdate to enable DDNS support") + elseif (NSUPDATE_EXECUTABLE) + message(STATUS "Install nslookup to enable DDNS support") + else () + message(STATUS "Install nslookup and nsupdate to enable DDNS support") + endif () +endif () + +add_executable(${IPCP_UDP4_TARGET} "${UDP_SOURCE_DIR}/udp4.c" ${IPCP_SOURCES}) +add_executable(${IPCP_UDP6_TARGET} "${UDP_SOURCE_DIR}/udp6.c" ${IPCP_SOURCES}) + +foreach(target ${IPCP_UDP4_TARGET} ${IPCP_UDP6_TARGET}) + target_include_directories(${target} PRIVATE ${IPCP_INCLUDE_DIRS}) + target_link_libraries(${target} PUBLIC ouroboros-dev) +endforeach() + +install(TARGETS ${IPCP_UDP4_TARGET} ${IPCP_UDP6_TARGET} RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}) -- cgit v1.2.3