optimize CMakeLists.txt
This commit is contained in:
@@ -20,20 +20,9 @@ if (ENABLE_ASAN)
|
||||
-fsanitize=undefined
|
||||
-fno-omit-frame-pointer
|
||||
)
|
||||
|
||||
add_link_options(
|
||||
-fsanitize=address
|
||||
-fsanitize=undefined
|
||||
)
|
||||
message("asan is on. if have any problems, disable it.")
|
||||
endif ()
|
||||
|
||||
if (WIN32)
|
||||
add_link_options(
|
||||
-static
|
||||
)
|
||||
endif ()
|
||||
|
||||
# For CURL
|
||||
set(BUILD_STATIC_LIBS ON)
|
||||
if (WIN32)
|
||||
@@ -61,4 +50,19 @@ 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)
|
||||
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 ()
|
||||
Reference in New Issue
Block a user