linux.cmake 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Linux specific flags
  2. message(STATUS "Configuring for Linux")
  3. target_compile_definitions(
  4. common
  5. INTERFACE HAVE_GETHOSTBYNAME2
  6. HAVE_UNION_SEMUN
  7. HAVE_SCHED_YIELD
  8. HAVE_MSG_NOSIGNAL
  9. HAVE_MSGHDR_MSG_CONTROL
  10. HAVE_ALLOCA_H
  11. HAVE_TIMEGM
  12. HAVE_SCHED_SETSCHEDULER
  13. HAVE_IP_MREQN
  14. )
  15. target_link_libraries(common INTERFACE ${CMAKE_DL_LIBS} resolv)
  16. target_link_libraries(common_utils INTERFACE resolv)
  17. if(${RAW_SOCKS})
  18. target_compile_definitions(common INTERFACE USE_RAW_SOCKS)
  19. endif()
  20. if(NOT ${USE_FAST_LOCK})
  21. target_compile_definitions(common INTERFACE USE_PTHREAD_MUTEX)
  22. target_link_libraries(common INTERFACE pthread)
  23. message(STATUS "FAST_LOCK not available on this platform, using: USE_PTHREAD_MUTEX")
  24. else()
  25. # TODO: Check if this can be reached. Right now it is not possible to set
  26. # LOCK_METHOD, only USE_FAST_LOCK. This branch is reached when USE_FAST_LOCK
  27. # is set to true (meaning it is available on platform).
  28. # Check if lock_method is posix or pthread
  29. # if(LOCK_METHOD STREQUAL "USE_POSIX_SEM" OR LOCK_METHOD STREQUAL
  30. # "USE_PTHREAD_MUTEX")
  31. # message(STATUS "Using ${LOCK_METHOD} for locks")
  32. # target_link_libraries(common INTERFACE pthread)
  33. # endif()
  34. endif()
  35. if(NOT NO_SELECT)
  36. target_compile_definitions(common INTERFACE HAVE_SELECT)
  37. endif()
  38. # TODO introduce check for epoll
  39. if(NOT NO_EPOLL)
  40. target_compile_definitions(common INTERFACE HAVE_EPOLL)
  41. endif()
  42. # TODO introduce check for sigio
  43. if(NOT NO_SIGIO_RT)
  44. target_compile_definitions(common INTERFACE HAVE_SIGIO_RT SIGINFO64_WORKAROUND)
  45. endif()
  46. # TODO introduce check for futex