CMakeLists.txt 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. cmake_minimum_required(VERSION 3.13)
  2. if(POLICY CMP0079)
  3. cmake_policy(SET CMP0079 NEW)
  4. endif()
  5. set(CLIENT_SOURCES
  6. main.cpp
  7. parse_cl.cpp
  8. parse_cl.h
  9. )
  10. set(GETOPT_SOURCES
  11. getopt.cpp
  12. getopt.h
  13. )
  14. set(CLIENT_UWP_RESOURCES
  15. uwp/Logo.png
  16. uwp/package.appxManifest
  17. uwp/SmallLogo.png
  18. uwp/SmallLogo44x44.png
  19. uwp/SplashScreen.png
  20. uwp/StoreLogo.png
  21. uwp/Windows_TemporaryKey.pfx
  22. )
  23. if(WIN32)
  24. if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
  25. add_executable(datachannel-client ${CLIENT_SOURCES} ${GETOPT_SOURCES} ${CLIENT_UWP_RESOURCES})
  26. else()
  27. add_executable(datachannel-client ${CLIENT_SOURCES} ${GETOPT_SOURCES})
  28. endif()
  29. target_compile_definitions(datachannel-client PUBLIC STATIC_GETOPT)
  30. else()
  31. add_executable(datachannel-client ${CLIENT_SOURCES})
  32. endif()
  33. set_target_properties(datachannel-client PROPERTIES
  34. CXX_STANDARD 17
  35. OUTPUT_NAME client)
  36. set_target_properties(datachannel-client PROPERTIES
  37. XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.github.paullouisageneau.libdatachannel.examples.client)
  38. find_package(Threads REQUIRED)
  39. target_link_libraries(datachannel-client LibDataChannel::LibDataChannel Threads::Threads nlohmann_json::nlohmann_json)
  40. if(MSVC)
  41. add_custom_command(TARGET datachannel-client POST_BUILD
  42. COMMAND ${CMAKE_COMMAND} -E copy_if_different
  43. "$<TARGET_FILE_DIR:datachannel>/datachannel.dll"
  44. $<TARGET_FILE_DIR:datachannel-client>
  45. )
  46. endif()