From 1d07c8bf445a2434ebd07d5f609d35eec93a19ad Mon Sep 17 00:00:00 2001 From: = Date: Sun, 29 May 2022 14:49:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BD=BF=E7=94=A8cmake?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 26 ++++++++++++++++++++++++++ src/CMakeLists.txt | 10 ++++++++++ 2 files changed, 36 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 src/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..a017ac5 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.0) +project(conf-c) + +set(CMAKE_BUILD_TYPE Release) +#set(CMAKE_C_FLAGS_RELEASE "$ENV${CFLAGS} -O3 -Wall") + +include_directories(src) + +add_subdirectory(src) +add_subdirectory(example) + +# uninstall target +if(NOT TARGET uninstall) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) + + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) +endif() + +include (CTest) + +add_test(example example/example) + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..5688153 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.0) +project(conf-c) +file(GLOB sources .) +message(STATUS, "lib src is ${sources}") +add_library(${PROJECT_NAME} SHARED ${sources}) +add_library(confc::library ALIAS ${PROJECT_NAME}) +set_target_properties(${PROJECT_NAME} PROPERTIES VERSION 0.4 SOVERSION 1) +target_include_directories(${PROJECT_NAME} + PUBLIC ${PROJECT_SOURCE_DIR}/src + )