-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCMakeLists.txt
123 lines (103 loc) · 3.46 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
cmake_minimum_required(VERSION 3.8.0)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
add_subdirectory("docs")
project(qutepart)
set(QUTEPART_VERSION_MAJOR 0)
set(QUTEPART_VERSION_MINOR 1)
set(QUTEPART_VERSION_PATCH 0)
set(QUTEPART_VERSION
${QUTEPART_VERSION_MAJOR}.${QUTEPART_VERSION_MINOR}.${QUTEPART_VERSION_PATCH})
set(QUTEPART_VERSION ${QUTEPART_VERSION} PARENT_SCOPE)
# Instruct CMake to run moc automatically when needed
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 14)
# Find the QtWidgets library
find_package(Qt5Core CONFIG REQUIRED)
find_package(Qt5Widgets CONFIG REQUIRED)
find_package(Qt5Test CONFIG REQUIRED)
# Populate a CMake variable with the sources
set(qutepart_SRCS
qutepart-syntax-files.qrc
src/qutepart.cpp
src/lines.cpp
src/char_iterator.cpp
src/text_block_utils.cpp
src/text_block_flags.cpp
src/bracket_highlighter.cpp
src/side_areas.cpp
src/completer.cpp
src/html_delegate.cpp
src/hl_factory.cpp
src/hl/context.cpp
src/hl/language.cpp
src/hl/loader.cpp
src/hl/rules.cpp
src/hl/syntax_highlighter.cpp
src/hl/style.cpp
src/hl/context_stack.cpp
src/hl/context_switcher.cpp
src/hl/text_block_user_data.cpp
src/hl/text_to_match.cpp
src/hl/match_result.cpp
src/hl/language_db_generated.cpp
src/hl/language_db.cpp
src/hl/text_type.cpp
src/indent/indenter.cpp
src/indent/indent_funcs.cpp
src/indent/alg_impl.cpp
src/indent/alg_lisp.cpp
src/indent/alg_xml.cpp
src/indent/alg_scheme.cpp
src/indent/alg_python.cpp
src/indent/alg_ruby.cpp
src/indent/alg_cstyle.cpp
)
include_directories(include/qutepart)
include_directories(src)
include_directories(test)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Tell CMake to create the qutepart library
add_library(qutepart ${qutepart_SRCS} include/qutepart/qutepart.h)
# Use the Widgets module from Qt 5
target_link_libraries(qutepart Qt5::Core Qt5::Widgets)
target_compile_options(qutepart PRIVATE -Wall -Wextra -pedantic -Werror)
# Build example executable
add_executable(editor editor.cpp)
target_link_libraries(editor Qt5::Core Qt5::Widgets qutepart)
# Install only library, not binaries
install(TARGETS qutepart DESTINATION lib)
install(FILES include/qutepart/hl_factory.h include/qutepart/qutepart.h DESTINATION include/qutepart)
# Tests
if(NOT DEFINED DISABLE_QUTEPART_TESTS)
enable_testing()
function(indent_test name)
set(full_name test_indenter_${name})
add_executable(${full_name} test/indenter/base_indenter_test.cpp test/indenter/${full_name}.cpp)
target_link_libraries(${full_name} Qt5::Test Qt5::Core Qt5::Widgets qutepart)
add_test(NAME ${name} COMMAND ${full_name})
endfunction()
indent_test(normal)
indent_test(python)
indent_test(ruby)
indent_test(cstyle)
indent_test(xml)
indent_test(scheme)
indent_test(lisp)
# indent_test(haskel)
function(qpart_test name)
set(full_name test_${name})
add_executable(${full_name} test/${full_name}.cpp)
target_link_libraries(${full_name} Qt5::Test Qt5::Core Qt5::Widgets qutepart)
add_test(NAME ${name} COMMAND ${full_name})
endfunction()
qpart_test(char_iterator)
qpart_test(text_block_utils)
qpart_test(line_iterator)
qpart_test(api)
qpart_test(line)
qpart_test(lines)
qpart_test(line_edit_operations)
qpart_test(edit_operations)
qpart_test(bracket_highlighter)
endif()