@@ -195,49 +195,35 @@ if (NOT APPLE)
195
195
set (SYS_LIBS ${SYS_LIBS} ${LIB_RT} )
196
196
endif ()
197
197
198
- if (EVHTP_BUILD_SHARED)
199
- add_library (libevhtpShared SHARED ${LIBEVHTP_SOURCES} ${ONIG_SOURCES} )
200
- set_target_properties (libevhtpShared PROPERTIES OUTPUT_NAME "evhtp" )
201
- target_link_libraries (libevhtpShared ${LIBEVHTP_EXTERNAL_LIBS} )
202
- install (TARGETS libevhtpShared DESTINATION lib)
203
-
204
- add_executable (test test .c)
205
- target_link_libraries (test libevhtpShared ${LIBEVHTP_EXTERNAL_LIBS} ${SYS_LIBS} )
206
-
207
- add_executable (test_basic test_basic.c)
208
- target_link_libraries (test_basic libevhtpShared ${LIBEVHTP_EXTERNAL_LIBS} ${SYS_LIBS} )
209
-
210
- add_executable (test_vhost test_vhost.c)
211
- target_link_libraries (test_vhost libevhtpShared ${LIBEVHTP_EXTERNAL_LIBS} ${SYS_LIBS} )
212
-
213
- add_executable (test_client test_client.c)
214
- target_link_libraries (test_client libevhtpShared ${LIBEVHTP_EXTERNAL_LIBS} ${SYS_LIBS} )
215
-
216
- add_executable (test_proxy test_proxy.c)
217
- target_link_libraries (test_proxy libevhtpShared ${LIBEVHTP_EXTERNAL_LIBS} ${SYS_LIBS} )
198
+ add_custom_target (examples)
218
199
200
+ if (EVHTP_BUILD_SHARED)
201
+ set (EVHTP_LIBTYPE SHARED)
219
202
else ()
220
- add_library (libevhtpStatic STATIC ${LIBEVHTP_SOURCES} ${ONIG_SOURCES} )
221
- set_target_properties (libevhtpStatic PROPERTIES OUTPUT_NAME "evhtp" )
222
- install (TARGETS libevhtpStatic DESTINATION lib)
203
+ set (EVHTP_LIBTYPE STATIC )
204
+ endif ()
223
205
224
- add_executable (test test .c)
225
- target_link_libraries (test libevhtpStatic ${LIBEVHTP_EXTERNAL_LIBS} ${SYS_LIBS} )
206
+ add_library (libevhtp ${EVHTP_LIBTYPE} ${LIBEVHTP_SOURCES} ${ONIG_SOURCES} )
226
207
227
- add_executable (test_basic test_basic.c )
228
- target_link_libraries (test_basic libevhtpStatic ${LIBEVHTP_EXTERNAL_LIBS} ${SYS_LIBS } )
208
+ set_target_properties (libevhtp PROPERTIES OUTPUT_NAME "evhtp" )
209
+ target_link_libraries (libevhtp ${LIBEVHTP_EXTERNAL_LIBS} )
229
210
230
- add_executable (test_vhost test_vhost.c)
231
- target_link_libraries (test_vhost libevhtpStatic ${LIBEVHTP_EXTERNAL_LIBS} ${SYS_LIBS} )
232
211
233
- add_executable (test_client test_client.c)
234
- target_link_libraries (test_client libevhtpStatic ${LIBEVHTP_EXTERNAL_LIBS} ${SYS_LIBS} )
212
+ add_executable (test EXCLUDE_FROM_ALL examples/test .c)
213
+ add_executable (test_basic EXCLUDE_FROM_ALL examples/test_basic.c)
214
+ add_executable (test_vhost EXCLUDE_FROM_ALL examples/test_vhost.c)
215
+ add_executable (test_client EXCLUDE_FROM_ALL examples/test_client.c)
216
+ add_executable (test_proxy EXCLUDE_FROM_ALL examples/test_proxy.c)
235
217
236
- add_executable (test_proxy test_proxy.c)
237
- target_link_libraries (test_proxy libevhtpStatic ${LIBEVHTP_EXTERNAL_LIBS} ${SYS_LIBS} )
218
+ target_link_libraries (test libevhtp ${LIBEVHTP_EXTERNAL_LIBS} ${SYS_LIBS} )
219
+ target_link_libraries (test_basic libevhtp ${LIBEVHTP_EXTERNAL_LIBS} ${SYS_LIBS} )
220
+ target_link_libraries (test_vhost libevhtp ${LIBEVHTP_EXTERNAL_LIBS} ${SYS_LIBS} )
221
+ target_link_libraries (test_client libevhtp ${LIBEVHTP_EXTERNAL_LIBS} ${SYS_LIBS} )
222
+ target_link_libraries (test_proxy libevhtp ${LIBEVHTP_EXTERNAL_LIBS} ${SYS_LIBS} )
238
223
239
- endif ( )
224
+ add_dependencies (examples test test_basic test_vhost test_client test_proxy )
240
225
226
+ install (TARGETS libevhtp DESTINATION lib)
241
227
install (FILES evhtp.h DESTINATION include )
242
228
install (FILES htparse/htparse.h DESTINATION include )
243
229
install (FILES evthr/evthr.h DESTINATION include )
0 commit comments