CMakeLists.txt 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. include_directories(${PROJECT_BINARY_DIR}
  2. ${PROJECT_BINARY_DIR}/src_generated
  3. ${PROJECT_SOURCE_DIR}/plugins)
  4. #############
  5. # Tutorials #
  6. #############
  7. add_executable(tutorial_datatypes tutorial_datatypes.c)
  8. target_link_libraries(tutorial_datatypes open62541 ${open62541_LIBRARIES})
  9. add_executable(tutorial_server_firststeps tutorial_server_firststeps.c)
  10. target_link_libraries(tutorial_server_firststeps open62541 ${open62541_LIBRARIES})
  11. add_executable(tutorial_server_variable tutorial_server_variable.c)
  12. target_link_libraries(tutorial_server_variable open62541 ${open62541_LIBRARIES})
  13. add_executable(tutorial_server_datasource tutorial_server_datasource.c)
  14. target_link_libraries(tutorial_server_datasource open62541 ${open62541_LIBRARIES})
  15. add_executable(tutorial_server_variabletype tutorial_server_variabletype.c)
  16. target_link_libraries(tutorial_server_variabletype open62541 ${open62541_LIBRARIES})
  17. add_executable(tutorial_server_object tutorial_server_object.c)
  18. target_link_libraries(tutorial_server_object open62541 ${open62541_LIBRARIES})
  19. if(UA_ENABLE_METHODCALLS)
  20. add_executable(tutorial_server_method tutorial_server_method.c)
  21. target_link_libraries(tutorial_server_method open62541 ${open62541_LIBRARIES})
  22. endif()
  23. add_executable(tutorial_client_firststeps tutorial_client_firststeps.c)
  24. target_link_libraries(tutorial_client_firststeps open62541 ${open62541_LIBRARIES})
  25. ##################
  26. # Example Server #
  27. ##################
  28. add_executable(server server.c)
  29. target_link_libraries(server open62541 ${open62541_LIBRARIES})
  30. if(UA_ENABLE_NONSTANDARD_UDP)
  31. add_executable(server_udp server_udp.c ${PROJECT_SOURCE_DIR}/plugins/ua_network_udp.c)
  32. target_link_libraries(server_udp open62541 ${open62541_LIBRARIES})
  33. endif()
  34. ##################
  35. # Example Client #
  36. ##################
  37. add_executable(client client.c)
  38. target_link_libraries(client open62541 ${open62541_LIBRARIES})
  39. ####################
  40. # Feature Examples #
  41. ####################
  42. add_executable(server_mainloop server_mainloop.c)
  43. target_link_libraries(server_mainloop open62541 ${open62541_LIBRARIES})
  44. add_executable(server_instantiation server_instantiation.c)
  45. target_link_libraries(server_instantiation open62541 ${open62541_LIBRARIES})
  46. add_executable(server_repeated_job server_repeated_job.c)
  47. target_link_libraries(server_repeated_job open62541 ${open62541_LIBRARIES})
  48. add_executable(server_inheritance server_inheritance.c)
  49. target_link_libraries(server_inheritance open62541 ${open62541_LIBRARIES})
  50. if(NOT BUILD_SHARED_open62541_LIBRARIES AND UA_BUILD_EXAMPLES_NODESET_COMPILER)
  51. # needs internal methods which are not exported in the dynamic lib
  52. add_executable(server_nodeset server_nodeset.c ${PROJECT_BINARY_DIR}/src_generated/nodeset.c)
  53. target_link_libraries(server_nodeset open62541 ${open62541_LIBRARIES})
  54. target_include_directories(server_nodeset PRIVATE ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/deps) # needs an internal header
  55. endif()
  56. if(UA_BUILD_SELFSIGNED_CERTIFICATE)
  57. find_package(OpenSSL REQUIRED)
  58. add_custom_command(OUTPUT server_cert.der ca.crt
  59. COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/certs/create_self-signed.py ${CMAKE_CURRENT_BINARY_DIR}
  60. DEPENDS ${PROJECT_SOURCE_DIR}/tools/certs/create_self-signed.py
  61. ${PROJECT_SOURCE_DIR}/tools/certs/localhost.cnf)
  62. add_custom_target(selfsigned ALL DEPENDS server_cert.der ca.crt)
  63. add_executable(server_certificate server_certificate.c server_cert.der ca.crt)
  64. target_link_libraries(server_certificate open62541 ${open62541_LIBRARIES})
  65. endif()