CMakeLists.txt 851 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. cmake_minimum_required(VERSION 2.6)
  2. project(enet C)
  3. set(ENET_DEBUG "0" CACHE BOOL "Enable debug functionality")
  4. set(ENET_STATIC "0" CACHE BOOL "Create a static library")
  5. set(ENET_SHARED "0" CACHE BOOL "Create a shared library")
  6. set(ENET_LZ4 "0" CACHE BOOL "Add support for an optional packet-level compression")
  7. if (MSVC)
  8. add_definitions(-W3)
  9. else()
  10. add_definitions(-Wno-error)
  11. endif()
  12. if (ENET_DEBUG)
  13. add_definitions(-DENET_DEBUG)
  14. endif()
  15. if (ENET_LZ4)
  16. add_definitions(-DENET_LZ4)
  17. set(SOURCES lz4/lz4.c)
  18. endif()
  19. if (ENET_STATIC)
  20. add_library(enet_static STATIC enet.c ${SOURCES})
  21. if (WIN32)
  22. target_link_libraries(enet_static winmm ws2_32)
  23. endif()
  24. endif()
  25. if (ENET_SHARED)
  26. add_library(enet SHARED enet.c ${SOURCES})
  27. if (WIN32)
  28. target_link_libraries(enet winmm ws2_32)
  29. endif()
  30. endif()