WebDisk_C/CMakeLists.txt

26 lines
711 B
CMake

cmake_minimum_required(VERSION 3.5)
project(webdisk_c LANGUAGES C)
add_executable(webdisk_c main.c cJSON/cJSON.c)
option(USE_JEMALLOC "Build JEMALLOC" ON)
option(JEMALLOC_STATIC "JEMALLOC static" ON)
if(USE_JEMALLOC)
target_compile_definitions(webdisk_c PRIVATE USE_JEMALLOC)
if(JEMALLOC_STATIC)
target_link_libraries(webdisk_c PRIVATE
"${CMAKE_SOURCE_DIR}/jemalloc/build/lib/libjemalloc.a"
)
else()
target_link_libraries(webdisk_c jemalloc)
target_link_directories(webdisk_c PRIVATE
"${CMAKE_SOURCE_DIR}/jemalloc/build/lib"
)
endif()
endif()
target_include_directories(webdisk_c PRIVATE
"${CMAKE_SOURCE_DIR}/jemalloc/build/include"
)
install(TARGETS webdisk_c RUNTIME DESTINATION bin)