This repository has been archived by the owner on Aug 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMakeLists.txt
46 lines (35 loc) · 1.61 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
cmake_minimum_required(VERSION 3.3)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
project(libconvert C)
option(BUILD_TESTS "" OFF)
option(BUILD_EXAMPLES "" OFF)
add_subdirectory(lib/syscall_intercept)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -Wextra")
include_directories(lib)
include_directories(lib/syscall_intercept/include)
include_directories(lib/log.c/src)
# libconvert_util
add_library(convert_util SHARED convert_util.c)
# libconvert_client
add_library(convert_client SHARED convert_client.c lib/log.c/src/log.c)
target_link_libraries(convert_client PRIVATE syscall_intercept_static convert_util)
# Unit & integration tests
add_subdirectory(tests)
# Tests for code linting & formatting
enable_testing()
list(APPEND LIBCONVERT_SOURCES convert_client.c convert.h convert_util.c convert_util.h)
add_test(NAME uncrustify
COMMAND uncrustify -c uncrustify.cfg --check -l C ${LIBCONVERT_SOURCES}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
add_test(NAME cppcheck
COMMAND cppcheck -I/usr/include -q
--language=c --std=c99 --error-exitcode=1
--enable=warning,style,performance,portability
--suppress=unusedStructMember ${LIBCONVERT_SOURCES}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
add_test(NAME scan-build
COMMAND bash -c "rm -rf scan-build && \
mkdir scan-build && \
cd scan-build && \
scan-build-6.0 cmake ${PROJECT_SOURCE_DIR} && \
scan-build-6.0 -v --status-bugs make")