forked from cantyonion/LiveParise
58 lines
1.2 KiB
CMake
58 lines
1.2 KiB
CMake
cmake_minimum_required(VERSION 3.23)
|
|
project(Live\ Parise C)
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
|
|
|
|
include(FetchContent)
|
|
|
|
option(ENABLE_ASAN "Enable AddressSanitizer" ON)
|
|
|
|
add_compile_options(
|
|
-Wall
|
|
-Wextra
|
|
)
|
|
|
|
if (ENABLE_ASAN)
|
|
add_compile_options(
|
|
-fsanitize=address
|
|
-fsanitize=undefined
|
|
-fno-omit-frame-pointer
|
|
)
|
|
|
|
add_link_options(
|
|
-fsanitize=address
|
|
-fsanitize=undefined
|
|
)
|
|
message("asan is on. if have any problems, disable it.")
|
|
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
|
|
GIT_REPOSITORY https://github.com/DaveGamble/cJSON.git
|
|
GIT_TAG v1.7.18
|
|
)
|
|
|
|
FetchContent_Declare(
|
|
curl
|
|
GIT_REPOSITORY https://github.com/curl/curl.git
|
|
GIT_TAG curl-8_9_1
|
|
)
|
|
|
|
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 pthread) |