forked from open62541/open62541
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
96 lines (74 loc) · 3.66 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
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_SOURCE_DIR}/plugins)
if(UA_ENABLE_AMALGAMATION)
include_directories(${PROJECT_BINARY_DIR}) # contain open62541.h
else()
add_definitions(-DUA_NO_AMALGAMATION)
endif()
list(APPEND LIBS ${open62541_LIBRARIES})
if(NOT WIN32)
list(APPEND LIBS pthread)
if (NOT APPLE)
list(APPEND LIBS rt)
endif()
else()
list(APPEND LIBS ws2_32)
endif()
if(UA_ENABLE_MULTITHREADING)
list(APPEND LIBS urcu-cds urcu urcu-common)
endif(UA_ENABLE_MULTITHREADING)
##################
# Example Server #
##################
add_executable(server server.c $<TARGET_OBJECTS:open62541-object>)
target_link_libraries(server ${LIBS})
if(UA_ENABLE_NONSTANDARD_UDP)
add_executable(server_udp server_udp.c $<TARGET_OBJECTS:open62541-object> ${PROJECT_SOURCE_DIR}/plugins/ua_network_udp.c)
target_link_libraries(server_udp ${LIBS})
endif()
##################
# Example Client #
##################
add_executable(client client.c $<TARGET_OBJECTS:open62541-object>)
target_link_libraries(client ${LIBS})
####################
# Feature Examples #
####################
add_executable(server_variable server_variable.c $<TARGET_OBJECTS:open62541-object>)
target_link_libraries(server_variable ${LIBS})
add_executable(server_mainloop server_mainloop.c $<TARGET_OBJECTS:open62541-object>)
target_link_libraries(server_mainloop ${LIBS})
add_executable(server_datasource server_datasource.c $<TARGET_OBJECTS:open62541-object>)
target_link_libraries(server_datasource ${LIBS})
add_executable(server_firstSteps server_firstSteps.c $<TARGET_OBJECTS:open62541-object>)
target_link_libraries(server_firstSteps ${LIBS})
add_executable(client_firstSteps client_firstSteps.c $<TARGET_OBJECTS:open62541-object>)
target_link_libraries(client_firstSteps ${LIBS})
add_executable(server_instantiation server_instantiation.c $<TARGET_OBJECTS:open62541-object>)
target_link_libraries(server_instantiation ${LIBS})
add_executable(server_repeated_job server_repeated_job.c $<TARGET_OBJECTS:open62541-object>)
target_link_libraries(server_repeated_job ${LIBS})
add_executable(server_inheritance server_inheritance.c $<TARGET_OBJECTS:open62541-object>)
target_link_libraries(server_inheritance ${LIBS})
if(UA_BUILD_EXAMPLES_NODESET_COMPILER)
add_executable(server_nodeset server_nodeset.c ${PROJECT_BINARY_DIR}/src_generated/nodeset.c $<TARGET_OBJECTS:open62541-object>)
target_link_libraries(server_nodeset ${LIBS})
target_include_directories(server_nodeset PRIVATE ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/deps) # needs an internal header
endif()
if(UA_ENABLE_METHODCALLS)
add_executable(server_method server_method.c $<TARGET_OBJECTS:open62541-object>)
target_link_libraries(server_method ${LIBS})
endif()
if(UA_BUILD_SELFSIGNED_CERTIFICATE)
find_package(OpenSSL REQUIRED)
add_custom_command(OUTPUT server_cert.der ca.crt
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/certs/create_self-signed.py ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${PROJECT_SOURCE_DIR}/tools/certs/create_self-signed.py
${PROJECT_SOURCE_DIR}/tools/certs/localhost.cnf)
add_custom_target(selfsigned ALL DEPENDS server_cert.der ca.crt)
add_executable(server_certificate server_certificate.c $<TARGET_OBJECTS:open62541-object> server_cert.der ca.crt)
target_link_libraries(server_certificate ${LIBS})
endif()
add_executable(server_readspeed server_readspeed.c $<TARGET_OBJECTS:open62541-object>)
target_include_directories(server_readspeed PRIVATE ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/deps) # needs an internal header
target_link_libraries(server_readspeed ${LIBS})