From 05fe1f8e3617cf2f84f461f7c6708fe8c17a151b Mon Sep 17 00:00:00 2001 From: xfangfang <2553041586@qq.com> Date: Sun, 18 Feb 2024 05:28:34 +0800 Subject: [PATCH 5/5] Support enable ipv6 --- CMakeLists.txt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git CMakeLists.txt CMakeLists.txt index db53ea00..ba6adc99 100644 --- CMakeLists.txt +++ CMakeLists.txt @@ -1,13 +1,25 @@ cmake_minimum_required(VERSION 3.15) +option(MG_ENABLE_IPV6 "Enable IPv6 support" OFF) + +set(MG_CUSTOM_COMPILE_FLAGS) + add_library(mongoose STATIC ${CMAKE_CURRENT_SOURCE_DIR}/mongoose.c) if (__SWITCH__) - target_compile_options(mongoose PRIVATE -DMG_ARCH=10086) + list(APPEND MG_CUSTOM_COMPILE_FLAGS -D__SWITCH__) + list(APPEND MG_CUSTOM_COMPILE_FLAGS -DMG_ARCH=10086) endif () if (VITASDK) - target_compile_options(mongoose PRIVATE -DMG_ARCH=10010) + list(APPEND MG_CUSTOM_COMPILE_FLAGS -D__PSV_) + list(APPEND MG_CUSTOM_COMPILE_FLAGS -DMG_ARCH=10010) +endif () + +if (MG_ENABLE_IPV6) + message(STATUS "mongoose: Enabling IPv6 support") + list(APPEND MG_CUSTOM_COMPILE_FLAGS -DMG_ENABLE_IPV6) endif () +target_compile_options(mongoose PUBLIC ${MG_CUSTOM_COMPILE_FLAGS}) target_include_directories(mongoose PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) \ No newline at end of file -- 2.51.0