-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
125 lines (113 loc) · 3.7 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
124
125
cmake_minimum_required(VERSION 3.10)
project(hippocafe)
set(CMAKE_CXX_STANDARD 17)
option(BUILD_SHARED_LIBS "Build as a shared library" OFF)
option(CAFE_BUILD_TESTS "Build tests" OFF)
option(CAFE_BUILD_GEN "Build the class tree generator" OFF)
include(GNUInstallDirs)
if (${CAFE_BUILD_TESTS})
add_subdirectory(tests)
endif ()
if (${CAFE_BUILD_GEN})
add_subdirectory(gen)
endif ()
set(CAFE_HEADERS
include/cafe/class_reader.hpp
include/cafe/apidef.hpp
include/cafe/constant_pool.hpp
include/cafe/value.hpp
include/cafe/constants.hpp
include/cafe/label.hpp
include/cafe/annotation.hpp
include/cafe/instruction.hpp
include/cafe/class_file.hpp
include/cafe/class_writer.hpp
include/cafe/data_writer.hpp
src/visitor.hpp
include/hippo/cafe.hpp
include/cafe/class_tree.hpp
include/cafe/data_reader.hpp
include/cafe/analysis.hpp
include/cafe/result.hpp
)
set(CAFE_SOURCES
src/class_reader.cpp
src/value.cpp
src/constants.cpp
src/label.cpp
src/annotation.cpp
src/instruction.cpp
src/class_file.cpp
src/class_writer.cpp
src/data_writer.cpp
src/visitor.cpp
src/class_tree.cpp
src/data_reader.cpp
src/analysis.cpp
src/result.cpp
)
set(CAFE_GEN_SOURCES
src/gen/gen_class_tree.cpp src/gen/gen_class_tree.hpp
src/gen/gen_class_tree_0.cpp
src/gen/gen_class_tree_1.cpp
src/gen/gen_class_tree_2.cpp
src/gen/gen_class_tree_3.cpp
src/gen/gen_class_tree_4.cpp
src/gen/gen_class_tree_5.cpp
src/gen/gen_class_tree_6.cpp
src/gen/gen_class_tree_7.cpp
src/gen/gen_class_tree_8.cpp
src/gen/gen_class_tree_9.cpp
src/gen/gen_class_tree_10.cpp
src/gen/gen_class_tree_11.cpp
src/gen/gen_class_tree_12.cpp
src/gen/gen_class_tree_13.cpp
src/gen/gen_class_tree_14.cpp
src/gen/gen_class_tree_15.cpp
src/gen/gen_class_tree_16.cpp
src/gen/gen_class_tree_17.cpp
src/gen/gen_class_tree_18.cpp
src/gen/gen_class_tree_19.cpp
src/gen/gen_class_tree_20.cpp
src/gen/gen_class_tree_21.cpp
src/gen/gen_class_tree_22.cpp
src/gen/gen_class_tree_23.cpp
src/gen/gen_class_tree_24.cpp
src/gen/gen_class_tree_25.cpp
src/gen/gen_class_tree_26.cpp
src/gen/gen_class_tree_27.cpp
src/gen/gen_class_tree_28.cpp
src/gen/gen_class_tree_29.cpp
src/gen/gen_class_tree_30.cpp
src/gen/gen_class_tree_31.cpp
src/gen/gen_class_tree_32.cpp
)
add_library(hippocafe
${CAFE_HEADERS}
${CAFE_SOURCES}
${CAFE_GEN_SOURCES}
)
if (${BUILD_SHARED_LIBS} AND ${WIN32})
target_compile_definitions(hippocafe PUBLIC CAFE_SHARED_LIB)
target_compile_definitions(hippocafe PRIVATE CAFE_EXPORTS)
endif ()
if (${BUILD_SHARED_LIBS})
set_property(TARGET hippocafe PROPERTY POSITION_INDEPENDENT_CODE ON)
endif ()
target_include_directories(hippocafe PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(EXPORT ${PROJECT_NAME}
FILE ${PROJECT_NAME}-config.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)