CMakeLists.txt 927 B

1234567891011121314151617181920212223242526272829303132333435
  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 (ENET_DEBUG)
  8. add_definitions(-DENET_DEBUG)
  9. endif()
  10. if (ENET_LZ4)
  11. add_definitions(-DENET_LZ4)
  12. set(SOURCES lz4/lz4.c)
  13. endif()
  14. if (ENET_STATIC)
  15. add_library(enet_static STATIC enet.c ${SOURCES})
  16. if (NOT UNIX)
  17. target_link_libraries(enet_static winmm ws2_32)
  18. SET_TARGET_PROPERTIES(enet_static PROPERTIES PREFIX "")
  19. endif()
  20. endif()
  21. if (ENET_SHARED)
  22. add_definitions(-DENET_DLL)
  23. add_library(enet SHARED enet.c ${SOURCES})
  24. if (NOT UNIX)
  25. target_link_libraries(enet winmm ws2_32)
  26. SET_TARGET_PROPERTIES(enet PROPERTIES PREFIX "")
  27. endif()
  28. endif()