CMakeLists.txt 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. # ====================================================================
  2. # programs;
  3. # --------------------------------------------------------------------
  4. add_executable(efeu efeu.c)
  5. add_executable(efsu efsu.c)
  6. add_executable(efru efru.c)
  7. add_executable(efbu efbu.c)
  8. add_executable(edru edru.c)
  9. add_executable(edsu edsu.c)
  10. if (WIN32)
  11. add_executable(pcapdevs pcapdevs.c)
  12. #else (WIN32)
  13. # add_executable(nics nics.c hostnics.c)
  14. # target_link_libraries(nics tools)
  15. # add_executable(client client.c)
  16. # target_link_libraries(client tools)
  17. # add_executable(server server.c)
  18. # target_link_libraries(server tools)
  19. endif (WIN32)
  20. # ====================================================================
  21. # dependencies;
  22. # --------------------------------------------------------------------
  23. target_link_libraries(efeu ether tools)
  24. target_link_libraries(efsu ether tools)
  25. target_link_libraries(efru ether tools)
  26. # ====================================================================
  27. # programs;
  28. # --------------------------------------------------------------------
  29. if (WIN32)
  30. target_link_libraries(efbu ether tools ws2_32)
  31. target_link_libraries(edru ether tools ws2_32)
  32. target_link_libraries(edsu ether tools ws2_32)
  33. target_link_libraries(pcapdevs ether tools)
  34. else (WIN32)
  35. target_link_libraries(efbu ether tools)
  36. target_link_libraries(edru ether tools)
  37. target_link_libraries(edsu ether tools)
  38. endif (WIN32)
  39. #
  40. # Platform specific executables.
  41. #
  42. if (WIN32)
  43. add_executable(pcapdevs pcapdevs.c)
  44. target_link_libraries(pcapdevs ether tools)
  45. #else (WIN32)
  46. # add_executable(nics nics.c hostnics.c)
  47. # target_link_libraries(nics tools)
  48. # add_executable(client client.c)
  49. # target_link_libraries(client tools)
  50. #
  51. # add_executable(server server.c)
  52. # target_link_libraries(server tools)
  53. endif (WIN32)
  54. #
  55. # Libraries.
  56. #
  57. set(ETHER_SRC openchannel.c closechannel.c sendpacket.c readpacket.c channel.c gethwaddr.c)
  58. if (WIN32)
  59. set(ETHER_SRC ${ETHER_SRC} getifname.c)
  60. else (WIN32)
  61. set(ETHER_SRC ${ETHER_SRC} hostnics.c)
  62. endif (WIN32)
  63. add_library(ether ${ETHER_SRC})
  64. if (WIN32)
  65. target_link_libraries(ether tools Packet wpcap)
  66. else (WIN32)
  67. target_link_libraries(ether tools)
  68. endif (WIN32)
  69. #
  70. # Install.
  71. #
  72. set(ETHER_INSTALL efeu efsu efru efbu edru edsu)
  73. if (WIN32)
  74. set(ETHER_INSTALL ${ETHER_INSTALL} pcapdevs)
  75. else (WIN32)
  76. # set(ETHER_INSTALL ${ETHER_INSTALL} nics client server)
  77. endif (WIN32)
  78. install(TARGETS ${ETHER_INSTALL}
  79. RUNTIME DESTINATION bin
  80. PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE SETUID)