From 262189428e46a947046da1dba33eae8626a07557 Mon Sep 17 00:00:00 2001 From: Anton Sergeev Date: Wed, 15 Jul 2015 14:01:46 +0600 Subject: [PATCH] Add CMakeLists.txt Signed-off-by: Anton Sergeev --- CMakeLists.txt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..6d67ddd --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 2.8) + +set(PROJECT cJSON) + +project(${PROJECT} C) + +file(GLOB HEADERS cJSON.h) +set(SOURCES cJSON.c) + +add_library(${PROJECT} STATIC ${HEADERS} ${SOURCES}) +target_link_libraries(${PROJECT} m) + +add_library(${PROJECT}.shared SHARED ${HEADERS} ${SOURCES}) +set_target_properties(${PROJECT}.shared PROPERTIES OUTPUT_NAME cJSON) +target_link_libraries(${PROJECT}.shared m) + + +option(ENABLE_CJSON_TEST "Enable building cJSON test" OFF) +if(ENABLE_CJSON_TEST) + set(TEST_NAME cJSON_test) + add_executable(${TEST_NAME} test.c) + target_link_libraries(${TEST_NAME} ${PROJECT}) +endif()