CMakeLists.txt 1003 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. cmake_minimum_required(VERSION 2.9)
  2. project(enet C)
  3. set(ENET_DEBUG "0" CACHE BOOL "Enable debug functionality")
  4. if (WIN32)
  5. set(ENET_EXCLUDE_WINDOWS_H "0" CACHE BOOL "Exclude \"windows.h\" header")
  6. endif()
  7. set(ENET_STATIC "0" CACHE BOOL "Create a static library")
  8. set(ENET_SHARED "0" CACHE BOOL "Create a shared library")
  9. if (MSYS OR MINGW)
  10. set(CMAKE_C_FLAGS "-static")
  11. add_definitions(-DWINVER=0x0601)
  12. add_definitions(-D_WIN32_WINNT=0x0601)
  13. endif()
  14. if (ENET_DEBUG)
  15. add_definitions(-DENET_DEBUG)
  16. endif()
  17. if (ENET_STATIC)
  18. add_library(enet_static STATIC enet.c ${SOURCES})
  19. if (NOT UNIX)
  20. target_link_libraries(enet_static winmm ws2_32)
  21. SET_TARGET_PROPERTIES(enet_static PROPERTIES PREFIX "")
  22. endif()
  23. endif()
  24. if (ENET_SHARED)
  25. add_definitions(-DENET_DLL)
  26. add_library(enet SHARED enet.c ${SOURCES})
  27. if (NOT UNIX)
  28. target_link_libraries(enet winmm ws2_32)
  29. SET_TARGET_PROPERTIES(enet PROPERTIES PREFIX "")
  30. endif()
  31. endif()