From 39fdcb0c57bfeba598f00d77f190e731f26b25a1 Mon Sep 17 00:00:00 2001
From: sola.lu <sola.lu@greentest.com.cn>
Date: 周四, 24 4月 2025 18:25:01 +0800
Subject: [PATCH] 1.修改一下,把当前库改为刚从origin仓库拉去下来,然后添加了cmake构建文件的状态。

---
 CMakeLists.txt |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..0826c6e
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,44 @@
+cmake_minimum_required(VERSION 3.21)
+project(libscpi VERSION 2.1.0 LANGUAGES C)
+
+file(GLOB_RECURSE SRC_FILES
+    libscpi/inc/*.h
+    libscpi/src/*.c
+)
+
+add_library(scpi_static STATIC ${SRC_FILES})
+
+target_include_directories(scpi_static
+    PUBLIC
+        "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/libscpi/inc>"
+)
+
+# add_library(scpi SHARED ${SRC_FILES})
+
+# target_include_directories(scpi
+#     PUBLIC
+#         "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/libscpi/inc>"
+# )
+
+enable_testing()
+find_package(unofficial-cunit CONFIG REQUIRED)
+
+file(GLOB_RECURSE TEST_FILES
+    libscpi/test/*.c
+)
+foreach(test_file IN LISTS TEST_FILES)
+    cmake_path(GET test_file FILENAME test_name)
+
+    add_executable(${test_name} ${test_file})
+
+    target_link_libraries(${test_name} 
+        PRIVATE 
+            scpi_static
+            unofficial::cunit::cunit
+    )
+
+    add_test(
+        NAME "${test_name}"
+        COMMAND ${test_name}
+    )
+endforeach()

--
Gitblit v1.9.1