CMakeLists.txt 938 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. cmake_minimum_required(VERSION 3.0)
  2. project(enet C)
  3. # defaults
  4. set(ENET_STATIC ON)
  5. set(ENET_SHARED OFF)
  6. set(ENET_TEST OFF)
  7. # configure projects
  8. if (ENET_STATIC)
  9. add_library(enet STATIC test/library.c)
  10. if (WIN32)
  11. target_link_libraries(enet PUBLIC winmm ws2_32)
  12. endif()
  13. endif()
  14. if (ENET_SHARED)
  15. target_compile_definitions(enet PUBLIC -DENET_DLL)
  16. add_library(enet SHARED test/library.c)
  17. if (WIN32)
  18. target_link_libraries(enet PUBLIC winmm ws2_32)
  19. endif()
  20. endif()
  21. if (ENET_TEST)
  22. add_executable(enet_test test/build.c)
  23. target_include_directories(enet_test PRIVATE ${PROJECT_SOURCE_DIR}/include)
  24. if (WIN32)
  25. target_link_libraries(enet_test PUBLIC winmm ws2_32)
  26. endif()
  27. endif()
  28. if(MSVC)
  29. target_compile_options(enet PRIVATE -W3)
  30. else()
  31. target_compile_options(enet PRIVATE -Wno-error)
  32. endif()
  33. target_include_directories(enet PUBLIC ${PROJECT_SOURCE_DIR}/include)