-
Notifications
You must be signed in to change notification settings - Fork 299
/
CMakeLists.txt
94 lines (81 loc) · 1.89 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
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
88
89
90
91
92
93
94
cmake_minimum_required(VERSION 3.22)
project(stylecheck.exe)
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
message(STATUS "Stylecheck out-of-tree configuration")
if( NOT DEFINED LLVM_PATH )
message(FATAL_ERROR "LLVM_PATH must be provided using -DLLVM_PATH=<path to llvm package root>")
endif()
link_directories(${LLVM_PATH}/lib)
include_directories(${LLVM_PATH}/include)
add_definitions(
-D__STDC_LIMIT_MACROS
-D__STDC_CONSTANT_MACROS
)
if( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
endif()
else()
message(STATUS "Stylecheck in-tree configuration")
endif()
add_executable(stylecheck.exe
stylecheck.cpp
utilsllvm.cpp
fileutils.cpp
)
if( MSVC )
# Disable warnings for Stylecheck
add_definitions(
-wd4722 # Suppress ''destructor'' : destructor never returns, potential memory leak
)
# Put project in solution folder
set_target_properties(stylecheck
PROPERTIES FOLDER "Clang executables"
)
else()
# Disable RTTI to be compatible with LLVM/Clang libraries.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti")
endif()
# Clang dependencies.
target_link_libraries(stylecheck.exe
clangTooling
clangFrontend
clangSerialization
clangDriver
clangParse
clangSema
clangAnalysis
clangAST
clangBasic
clangEdit
clangLex
clangASTMatchers
clang
)
# LLVM dependencies.
target_link_libraries(stylecheck.exe
#LLVMSupport
#LLVMTransformUtils
#LLVMMC # Object, Support
#LLVMMCParser # MC, Support
#LLVMObject # Support
#LLVMCore # Support
#LLVMBitReader
#LLVMScalarOpts
LLVMSupport
LLVMOption
)
# Platform dependencies.
if( WIN32 )
target_link_libraries(stylecheck.exe
shlwapi
)
else()
target_link_libraries(stylecheck.exe
pthread
dl
ncurses
z
)
endif()
install(TARGETS stylecheck.exe
RUNTIME DESTINATION bin)