CMakeLists.txt 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # ArduinoJson - arduinojson.org
  2. # Copyright Benoit Blanchon 2014-2023
  3. # MIT License
  4. if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
  5. add_compile_options(
  6. -pedantic
  7. -Wall
  8. -Wcast-align
  9. -Wcast-qual
  10. -Wconversion
  11. -Wctor-dtor-privacy
  12. -Wdisabled-optimization
  13. -Werror
  14. -Wextra
  15. -Wformat=2
  16. -Winit-self
  17. -Wmissing-include-dirs
  18. -Wnon-virtual-dtor
  19. -Wold-style-cast
  20. -Woverloaded-virtual
  21. -Wparentheses
  22. -Wredundant-decls
  23. -Wshadow
  24. -Wsign-promo
  25. -Wstrict-aliasing
  26. -Wundef
  27. )
  28. if(NOT MINGW)
  29. add_compile_options(
  30. -std=c++98
  31. )
  32. endif()
  33. endif()
  34. if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
  35. add_compile_options(
  36. -Wstrict-null-sentinel
  37. )
  38. if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.5)
  39. add_compile_options(-Wlogical-op) # the flag exists in 4.4 but is buggy
  40. endif()
  41. if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.6)
  42. add_compile_options(-Wnoexcept)
  43. endif()
  44. if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.7 AND
  45. CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
  46. # avoid false positive with GCC 4.7
  47. add_compile_options(-Wno-maybe-uninitialized)
  48. endif()
  49. endif()
  50. if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  51. add_compile_options(
  52. -Wc++11-compat
  53. -Wdeprecated-register
  54. )
  55. endif()
  56. if(MSVC)
  57. add_definitions(-D_CRT_SECURE_NO_WARNINGS)
  58. add_compile_options(
  59. /W4 # Set warning level
  60. /WX # Treats all compiler warnings as errors.
  61. )
  62. endif()
  63. add_subdirectory(DynamicJsonBuffer)
  64. add_subdirectory(IntegrationTests)
  65. add_subdirectory(JsonArray)
  66. add_subdirectory(JsonBuffer)
  67. add_subdirectory(JsonObject)
  68. add_subdirectory(JsonVariant)
  69. add_subdirectory(JsonWriter)
  70. add_subdirectory(Misc)
  71. add_subdirectory(Polyfills)
  72. add_subdirectory(StaticJsonBuffer)