From 187cd014f76dbf34c83d6d425b7712c1483667d1 Mon Sep 17 00:00:00 2001 From: hamjin Date: Sun, 8 Sep 2024 23:21:41 +0800 Subject: [PATCH] fix build for windows for clion and msys-mingw (clang and gcc) Signed-off-by: hamjin --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ea9fc9..d0567f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ project(Live\ Parise C) set(CMAKE_C_STANDARD 11) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) include(FetchContent) @@ -29,10 +30,14 @@ endif () # For CURL set(BUILD_STATIC_LIBS ON) +if(WIN32) + set(CURL_USE_SCHANNEL ON) +endif () # For cJSON set(BUILD_SHARED_AND_STATIC_LIBS ON) set(ENABLE_CUSTOM_COMPILER_FLAGS OFF) +set(ENABLE_CJSON_TEST OFF) FetchContent_Declare( cJSON @@ -50,4 +55,4 @@ FetchContent_MakeAvailable(cJSON curl) add_executable(main main.c) target_include_directories(main PUBLIC ${cJSON_SOURCE_DIR}) -target_link_libraries(main cjson-static libcurl_static) \ No newline at end of file +target_link_libraries(main cjson-static libcurl_static pthread) \ No newline at end of file