summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
author彭宣正 <[email protected]>2021-12-20 15:37:00 +0800
committer彭宣正 <[email protected]>2021-12-20 15:37:00 +0800
commit3488e3aba8008b0a3073a00e01332d872580779a (patch)
tree2c816b82f35a95716dd0317c6a21307b6281f339 /CMakeLists.txt
parent0dbf2e6957168a9f271881adf565918143f96586 (diff)
🧪 test(gtest. CI): 增加gtest用例,增加CPPCHECK,删除生成的可执行文件
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4a2b043..7863164 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,9 +14,28 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
set(CMAKE_INSTALL_PREFIX /opt/MESA)
set(LUAJIT_INSTALL_PREFIX /usr/local)
+find_program(CMAKE_CXX_CPPCHECK NAMES cppcheck)
+if (CMAKE_CXX_CPPCHECK)
+ list(
+ APPEND CMAKE_CXX_CPPCHECK
+ "--enable=all"
+ "--error-exitcode=1"
+ "--suppress=unusedFunction"
+ "--suppress=missingInclude"
+ "--suppress=uselessAssignmentPtrArg"
+ "--suppress=unmatchedSuppression"
+ )
+ set(CMAKE_C_CPPCHECK ${CMAKE_CXX_CPPCHECK})
+else()
+ message(FATAL_ERROR "Could not find the program cppcheck.")
+endif()
+
add_subdirectory(support)
add_subdirectory(src)
+enable_testing()
+add_subdirectory(gtest)
+
install(FILES ./src/tsg_lua_interface.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/MESA COMPONENT HEADER)
install(PROGRAMS ./example/checktools/checktools.lua DESTINATION ${LUAJIT_INSTALL_PREFIX}/bin)