From d2d4d0333a7a141b426df68b144af7ff9d902f90 Mon Sep 17 00:00:00 2001 From: Zephyr Lykos Date: Mon, 13 Nov 2023 16:05:35 +0800 Subject: [PATCH] cmake: add option to use system mongoose installation (#234) --- CMakeLists.txt | 3 ++- library/CMakeLists.txt | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3197b45a..ccf62f71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,7 @@ cmake_dependent_option(USE_SYSTEM_OPENCC "" OFF "NOT USE_SHARED_LIB" ON) cmake_dependent_option(USE_SYSTEM_FMT "" OFF "NOT USE_SHARED_LIB" ON) cmake_dependent_option(USE_SYSTEM_TINYXML2 "" OFF "NOT USE_SHARED_LIB" ON) cmake_dependent_option(USE_SYSTEM_SDL2 "Only for PSV" OFF "PLATFORM_PSV" OFF) +cmake_dependent_option(USE_SYSTEM_MONGOOSE "" OFF "NOT USE_SHARED_LIB" ON) option(DISABLE_OPENCC "Disable Chinese Simplified and Chinese Traditional Conversion " OFF) @@ -293,4 +294,4 @@ endif () target_include_directories(${PROJECT_NAME} PRIVATE wiliwili/include wiliwili/include/api ${APP_PLATFORM_INCLUDE}) target_compile_options(${PROJECT_NAME} PRIVATE -ffunction-sections -fdata-sections -Wunused-variable ${APP_PLATFORM_OPTION}) target_link_libraries(${PROJECT_NAME} PRIVATE wiliwiliLibExtra borealis lunasvg pystring pdr mongoose z ${APP_PLATFORM_LIB}) -target_link_options(${PROJECT_NAME} PRIVATE ${APP_PLATFORM_LINK_OPTION}) \ No newline at end of file +target_link_options(${PROJECT_NAME} PRIVATE ${APP_PLATFORM_LINK_OPTION}) diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index d44c7c38..61535c62 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -86,7 +86,13 @@ set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) add_subdirectory(lunasvg EXCLUDE_FROM_ALL) # add mongoose -add_subdirectory(mongoose EXCLUDE_FROM_ALL) +if (USE_SYSTEM_MONGOOSE) + find_library(MONGOOSE_LIBRARY NAMES mongoose REQUIRED) + add_library(mongoose UNKNOWN IMPORTED) + set_property(TARGET mongoose PROPERTY IMPORTED_LOCATION ${MONGOOSE_LIBRARY}) +else () + add_subdirectory(mongoose EXCLUDE_FROM_ALL) +endif () # add borealis add_subdirectory(borealis/library) @@ -104,4 +110,4 @@ elseif (PLATFORM_PSV) endif () add_library(wiliwiliLibExtra INTERFACE) -target_link_libraries(wiliwiliLibExtra INTERFACE cpr::cpr qrcode) \ No newline at end of file +target_link_libraries(wiliwiliLibExtra INTERFACE cpr::cpr qrcode)