forked from metacall/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
166 lines (130 loc) · 2.57 KB
/
CMakeLists.txt
File metadata and controls
166 lines (130 loc) · 2.57 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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# Check if this loader is enabled
if(NOT OPTION_BUILD_LOADERS OR NOT OPTION_BUILD_LOADERS_JAVA)
return()
endif()
#
# Executable name and options
#
# Target name
set(target java-loader-test)
message(STATUS "Test ${target}")
#
# Compiler warnings
#
include(Warnings)
#
# Compiler security
#
include(SecurityFlags)
#
# Sources
#
set(include_path "${CMAKE_CURRENT_SOURCE_DIR}/include/${target}")
set(source_path "${CMAKE_CURRENT_SOURCE_DIR}/source")
set(sources
${source_path}/main.cpp
${source_path}/java_loader_test.cpp
)
# Group source files
set(header_group "Header Files (API)")
set(source_group "Source Files")
source_group_by_path(${include_path} "\\\\.h$|\\\\.hpp$"
${header_group} ${headers})
source_group_by_path(${source_path} "\\\\.cpp$|\\\\.c$|\\\\.h$|\\\\.hpp$"
${source_group} ${sources})
#
# Create executable
#
# Build executable
add_executable(${target}
${sources}
)
# Create namespaced alias
add_executable(${META_PROJECT_NAME}::${target} ALIAS ${target})
#
# Project options
#
set_target_properties(${target}
PROPERTIES
${DEFAULT_PROJECT_OPTIONS}
FOLDER "${IDE_FOLDER}"
)
#
# Include directories
#
target_include_directories(${target}
PRIVATE
${DEFAULT_INCLUDE_DIRECTORIES}
${PROJECT_BINARY_DIR}/source/include
)
#
# Libraries
#
target_link_libraries(${target}
PRIVATE
${DEFAULT_LIBRARIES}
GTest
${META_PROJECT_NAME}::version
${META_PROJECT_NAME}::preprocessor
${META_PROJECT_NAME}::environment
${META_PROJECT_NAME}::format
${META_PROJECT_NAME}::threading
${META_PROJECT_NAME}::log
${META_PROJECT_NAME}::memory
${META_PROJECT_NAME}::portability
${META_PROJECT_NAME}::adt
${META_PROJECT_NAME}::filesystem
${META_PROJECT_NAME}::dynlink
${META_PROJECT_NAME}::detour
${META_PROJECT_NAME}::reflect
${META_PROJECT_NAME}::serial
${META_PROJECT_NAME}::configuration
${META_PROJECT_NAME}::loader
)
#
# Compile definitions
#
target_compile_definitions(${target}
PRIVATE
${DEFAULT_COMPILE_DEFINITIONS}
)
#
# Compile options
#
target_compile_options(${target}
PRIVATE
${DEFAULT_COMPILE_OPTIONS}
)
#
# Linker options
#
target_link_libraries(${target}
PRIVATE
${DEFAULT_LINKER_OPTIONS}
)
#
# Define test
#
add_test(NAME ${target}
# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND $<TARGET_FILE:${target}>
# TODO: Remove this
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/source/ports/scala_port
)
#
# Define dependencies
#
add_dependencies(${target}
java_loader
)
#
# Define test properties
#
set_property(TEST ${target}
PROPERTY LABELS ${target}
)
include(TestEnvironmentVariables)
test_environment_variables(${target}
""
${TESTS_ENVIRONMENT_VARIABLES}
)