You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.3KB

  1. set(CMAKE_CXX_STANDARD 11)
  2. include(FindPackageHandleStandardArgs)
  3. set(SOURCES PRIVATE
  4. io.c
  5. io.h
  6. core.c
  7. core.h
  8. netutils.c
  9. netutils.h)
  10. if (APPLE)
  11. list(APPEND SOURCES corewlan.m corewlan.h)
  12. endif ()
  13. add_executable(owl "")
  14. target_sources(owl ${SOURCES} owl.c)
  15. find_library(libpcap_LIBRARY NAMES pcap)
  16. find_path(libpcap_INCLUDE pcap.h)
  17. find_package_handle_standard_args(libpcap DEFAULT_MSG libpcap_LIBRARY libpcap_INCLUDE)
  18. if (NOT libpcap_FOUND)
  19. message(FATAL_ERROR "libpcap not found")
  20. endif ()
  21. find_library(libev_LIBRARY NAMES ev)
  22. find_path(libev_INCLUDE ev.h PATHS /usr/local/include)
  23. find_package_handle_standard_args(libev DEFAULT_MSG libev_LIBRARY libev_INCLUDE)
  24. if (NOT libev_FOUND)
  25. message(FATAL_ERROR "libev not found")
  26. endif ()
  27. if (APPLE)
  28. find_library(FOUNDATION Foundation)
  29. find_library(COREWLAN CoreWLAN)
  30. find_library(SYSTEMCONFIGURATION SystemConfiguration)
  31. endif ()
  32. target_include_directories(owl PRIVATE ${CMAKE_SOURCE_DIR}/src ${libev_INCLUDE})
  33. target_link_libraries(owl awdl ${libpcap_LIBRARY} ${libev_LIBRARY})
  34. if (APPLE)
  35. target_link_libraries(owl ${FOUNDATION} ${COREWLAN} ${SYSTEMCONFIGURATION})
  36. else ()
  37. target_include_directories(owl PRIVATE /usr/include/libnl3)
  38. target_link_libraries(owl nl-3 nl-genl-3 nl-route-3)
  39. endif ()
  40. install(TARGETS owl DESTINATION bin)