CMakeLists.txt 895 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. include_directories(${PROJECT_SOURCE_DIR})
  13. if (ENET_DEBUG)
  14. add_definitions(-DENET_DEBUG)
  15. endif()
  16. if (ENET_LZ4)
  17. add_definitions(-DENET_LZ4)
  18. set(SOURCES lz4/lz4.c)
  19. endif()
  20. if (ENET_STATIC)
  21. add_library(enet_static STATIC enet.c ${SOURCES})
  22. if (WIN32)
  23. target_link_libraries(enet_static winmm ws2_32)
  24. endif()
  25. endif()
  26. if (ENET_SHARED)
  27. add_library(enet SHARED enet.c ${SOURCES})
  28. if (WIN32)
  29. target_link_libraries(enet winmm ws2_32)
  30. endif()
  31. endif()