CMakeLists.txt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. cmake_minimum_required(VERSION 2.8)
  2. project(zt_osdep)
  3. set(src
  4. Arp.cpp
  5. EthernetTap.cpp
  6. ManagedRoute.cpp
  7. NeighborDiscovery.cpp
  8. OSUtils.cpp
  9. )
  10. set(headers
  11. Arp.hpp
  12. BlockingQueue.hpp
  13. EthernetTap.hpp
  14. ManagedRoute.hpp
  15. OSUtils.hpp
  16. Thread.hpp
  17. )
  18. if(WIN32)
  19. set(src ${src} WindowsEthernetTap.cpp)
  20. set(headers ${headers} WindowsEthernetTap.hpp)
  21. elseif(UNIX)
  22. if(APPLE)
  23. set(src ${src} MacEthernetTap.cpp MacKextEthernetTap.cpp)
  24. set(headers ${headers} MacEthernetTap.hpp MacKextEthernetTap.hpp)
  25. endif(APPLE)
  26. if(CMAKE_SYSTEM_NAME MATCHES "BSD")
  27. set(src ${src} BSDEthernetTap.cpp)
  28. set(headers ${headers} BSDEthernetTap.hpp)
  29. endif()
  30. if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
  31. set(src ${src} freebsd_getifmaddrs.c)
  32. set(headers ${headers} freebsd_getifmaddrs.h)
  33. endif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
  34. if(CMAKE_SYSTEM_NAME MATCHES "Linux")
  35. set(src ${src} LinuxEthernetTap.cpp LinuxNetLink.cpp)
  36. set(headers ${headers} LinuxEthernetTap.hpp LinuxNetLink.hpp)
  37. endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
  38. endif(WIN32)
  39. add_library(${PROJECT_NAME} STATIC ${src} ${headers})
  40. target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11)
  41. if(APPLE)
  42. add_executable(MacEthernetTapAgent MacEthernetTapAgent.c MacEthernetTapAgent.h)
  43. target_include_directories(MacEthernetTapAgent PRIVATE ${CMAKE_BINARY_DIR})
  44. endif(APPLE)