@@ -9,17 +9,14 @@ endif()
9
9
10
10
# Target name
11
11
set (target cxx_port)
12
- string (TOLOWER ${META_PROJECT_NAME} target_name)
13
-
14
- set (target_export "${META_PROJECT_NAME} -cxx" )
15
12
16
13
# Exit here if required dependencies are not met
17
14
message (STATUS "Port ${target} " )
18
15
19
16
# Set API export file and macro
20
- string (TOUPPER ${target_name} target_name_upper )
21
- set (export_file "include/${target_name } /${target_name } _api.hpp " )
22
- set (export_macro "${target_name_upper } _API" )
17
+ string (TOUPPER ${target} target_upper )
18
+ set (export_file "include/${target } /${target } _api.h " )
19
+ set (export_macro "${target_upper } _API" )
23
20
24
21
#
25
22
# Compiler warnings
@@ -37,8 +34,8 @@ include(SecurityFlags)
37
34
# Sources
38
35
#
39
36
40
- set (inline_path "${CMAKE_CURRENT_SOURCE_DIR} /inline/${target_name} " )
41
- set (include_path "${CMAKE_CURRENT_SOURCE_DIR} /include/${target_name} " )
37
+ set (inline_path "${CMAKE_CURRENT_SOURCE_DIR} /inline/metacall " )
38
+ set (include_path "${CMAKE_CURRENT_SOURCE_DIR} /include/metacall " )
42
39
set (source_path "${CMAKE_CURRENT_SOURCE_DIR} /source" )
43
40
44
41
set (inlines
@@ -79,7 +76,7 @@ add_library(${target}
79
76
add_library (${META_PROJECT_NAME} ::${target} ALIAS ${target} )
80
77
81
78
# Export library for downstream projects
82
- export (TARGETS ${target} NAMESPACE ${META_PROJECT_NAME} :: FILE ${PROJECT_BINARY_DIR} /cmake/${target_name } /${target_export } -export.cmake)
79
+ export (TARGETS ${target} NAMESPACE ${META_PROJECT_NAME} :: FILE ${PROJECT_BINARY_DIR} /cmake/${target } /${target } -export.cmake)
83
80
84
81
# Create API export header
85
82
generate_export_header(${target}
@@ -100,12 +97,16 @@ set_target_properties(${target}
100
97
#
101
98
# Include directories
102
99
#
100
+
103
101
target_include_directories (${target}
104
102
PRIVATE
105
103
${PROJECT_BINARY_DIR} /source /include
106
104
${CMAKE_CURRENT_SOURCE_DIR} /include
107
105
${CMAKE_CURRENT_BINARY_DIR} /include
106
+
107
+ ${PROJECT_BINARY_DIR} /source /inline
108
108
${CMAKE_CURRENT_SOURCE_DIR} /inline
109
+ ${CMAKE_CURRENT_BINARY_DIR} /inline
109
110
110
111
PUBLIC
111
112
${DEFAULT_INCLUDE_DIRECTORIES}
@@ -114,6 +115,26 @@ target_include_directories(${target}
114
115
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include >
115
116
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR} /include >
116
117
$<INSTALL_INTERFACE:include >
118
+
119
+
120
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /inline>
121
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR} /inline>
122
+ $<INSTALL_INTERFACE:inline>
123
+ )
124
+
125
+ #
126
+ # Libraries
127
+ #
128
+
129
+ target_link_libraries (${target}
130
+ PRIVATE
131
+ ${META_PROJECT_NAME} ::metacall
132
+
133
+ PUBLIC
134
+ ${DEFAULT_LIBRARIES}
135
+
136
+ INTERFACE
137
+ ${META_PROJECT_NAME} ::metacall
117
138
)
118
139
119
140
#
@@ -122,9 +143,10 @@ target_include_directories(${target}
122
143
123
144
target_compile_definitions (${target}
124
145
PRIVATE
146
+ ${target_upper} _EXPORTS # Export API
125
147
126
148
PUBLIC
127
- $<$<NOT :$<BOOL :${BUILD_SHARED_LIBS} >>:${target_name_upper } _STATIC_DEFINE>
149
+ $<$<NOT :$<BOOL :${BUILD_SHARED_LIBS} >>:${target_upper } _STATIC_DEFINE>
128
150
${DEFAULT_COMPILE_DEFINITIONS}
129
151
130
152
INTERFACE
@@ -155,72 +177,3 @@ target_link_options(${target}
155
177
156
178
INTERFACE
157
179
)
158
-
159
- #
160
- # Deployment
161
- #
162
-
163
- # Library
164
- install (TARGETS ${target}
165
- EXPORT "${target_export} -export" COMPONENT dev
166
- RUNTIME DESTINATION ${INSTALL_BIN} COMPONENT runtime
167
- LIBRARY DESTINATION ${INSTALL_SHARED} COMPONENT runtime
168
- ARCHIVE DESTINATION ${INSTALL_LIB} COMPONENT dev
169
- )
170
-
171
- # Inline files
172
- install (DIRECTORY
173
- ${CMAKE_CURRENT_SOURCE_DIR} /inline/${target_name} DESTINATION ${INSTALL_INCLUDE}
174
- COMPONENT dev
175
- )
176
-
177
- # Header files
178
- install (DIRECTORY
179
- ${CMAKE_CURRENT_SOURCE_DIR} /include /${target_name} DESTINATION ${INSTALL_INCLUDE}
180
- COMPONENT dev
181
- )
182
-
183
- # Generated header files
184
- install (DIRECTORY
185
- ${CMAKE_CURRENT_BINARY_DIR} /include /${target_name} DESTINATION ${INSTALL_INCLUDE}
186
- COMPONENT dev
187
- )
188
-
189
- # CMake config
190
- install (EXPORT ${target_export} -export
191
- NAMESPACE ${META_PROJECT_NAME} ::
192
- DESTINATION ${INSTALL_CMAKE} /${target_name}
193
- COMPONENT dev
194
- )
195
-
196
- # TODO
197
-
198
- # #
199
- # # Configure test
200
- # #
201
-
202
- # set(metacall_cxx_test "${target}_test")
203
- # set(metacall_cxx_test_path "${CMAKE_CURRENT_BINARY_DIR}/${metacall_cxx_test}.cpp")
204
-
205
- # #
206
- # # Define test
207
- # #
208
-
209
- # add_test(NAME ${metacall_cxx_test}
210
- # COMMAND $<TARGET_FILE:${metacall_cxx_test}>
211
- # )
212
-
213
- # #
214
- # # Define test labels
215
- # #
216
-
217
- # set_property(TEST ${metacall_cxx_test}
218
- # PROPERTY LABELS ${metacall_cxx_test}
219
- # )
220
-
221
- # include(TestEnvironmentVariables)
222
-
223
- # test_environment_variables(${metacall_cxx_test}
224
- # ""
225
- # ${TESTS_ENVIRONMENT_VARIABLES}
226
- # )
0 commit comments