forked from cantyonion/LiveParise
53 lines
1.1 KiB
CMake
53 lines
1.1 KiB
CMake
cmake_minimum_required(VERSION 3.30)
|
|
project(Live\ Parise C)
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
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)
|
|
|
|
# For cJSON
|
|
set(BUILD_SHARED_AND_STATIC_LIBS ON)
|
|
set(ENABLE_CUSTOM_COMPILER_FLAGS 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) |