Compare commits

...

2 Commits

Author SHA1 Message Date
7ddc6aad72 optimize CMakeLists.txt 2024-09-09 08:00:44 +08:00
be611c26c8 static link libpthread on win32 2024-09-09 07:51:20 +08:00

View File

@@ -20,17 +20,12 @@ if (ENABLE_ASAN)
-fsanitize=undefined -fsanitize=undefined
-fno-omit-frame-pointer -fno-omit-frame-pointer
) )
add_link_options(
-fsanitize=address
-fsanitize=undefined
)
message("asan is on. if have any problems, disable it.") message("asan is on. if have any problems, disable it.")
endif () endif ()
# For CURL # For CURL
set(BUILD_STATIC_LIBS ON) set(BUILD_STATIC_LIBS ON)
if(WIN32) if (WIN32)
set(CURL_USE_SCHANNEL ON) set(CURL_USE_SCHANNEL ON)
endif () endif ()
@@ -55,4 +50,19 @@ FetchContent_MakeAvailable(cJSON curl)
add_executable(main main.c) add_executable(main main.c)
target_include_directories(main PUBLIC ${cJSON_SOURCE_DIR}) target_include_directories(main PUBLIC ${cJSON_SOURCE_DIR})
target_link_libraries(main cjson-static libcurl_static pthread) target_link_libraries(main cjson-static libcurl_static pthread)
if (ENABLE_ASAN)
target_link_options(
main BEFORE PUBLIC
-fsanitize=address
-fsanitize=undefined
)
endif ()
if (WIN32)
target_link_options(
main BEFORE PUBLIC
-static
)
endif ()