CMakeLists.txt 903 B

123456789101112131415161718192021222324252627282930313233343536
  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. if (MSYS OR MINGW)
  7. set(CMAKE_C_FLAGS "-static")
  8. add_definitions(-DWINVER=0x0601)
  9. add_definitions(-D_WIN32_WINNT=0x0601)
  10. endif()
  11. if (ENET_DEBUG)
  12. add_definitions(-DENET_DEBUG)
  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()