-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
87 lines (77 loc) · 1.86 KB
/
CMakeLists.txt
File metadata and controls
87 lines (77 loc) · 1.86 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
cmake_minimum_required(VERSION 3.20)
project(
codebase_analyzer
VERSION 1.0.0
LANGUAGES C
)
# ------------------------------
# Global configuration
# ------------------------------
set(CMAKE_C_STANDARD 17)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_BUILD_TYPE DEBUG)
# Default build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE)
endif()
# ------------------------------
# Dependencies
# ------------------------------
find_package(cJSON REQUIRED)
find_package(CURL REQUIRED)
# ------------------------------
# Warnings & compiler flags
# ------------------------------
if(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
add_compile_options(
-Wall
-Wextra
-Wpedantic
-Wshadow
-Wstrict-prototypes
-Wmissing-prototypes
-Wconversion
-Wno-unused-parameter
)
endif()
# ------------------------------
# Sanitizers (Debug only)
# ------------------------------
if(CMAKE_BUILD_TYPE STREQUAL "Debug"
AND CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
add_compile_options(-fsanitize=address,undefined)
add_link_options(-fsanitize=address,undefined)
endif()
# ------------------------------
# Project layout
# ------------------------------
add_executable(cba
src/symbol_extractor/directory_scanner.c
src/symbol_extractor/file_symbol_extractor.c
src/symbol_extractor/symbol_content_extractor.c
src/symbol_extractor/symbol_typedef.c
src/main.c
src/parser.c
)
target_link_libraries(cba
PRIVATE
tree-sitter
tree-sitter-c
cjson
CURL::libcurl
)
add_executable(Treesitter_Test
tests/treesitter.c
)
target_link_libraries(Treesitter_Test
PRIVATE
tree-sitter
tree-sitter-c
)
# ------------------------------
# Installation (optional)
# ------------------------------
install(TARGETS cba
RUNTIME DESTINATION bin)