CMakeLists.txt 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # ArduinoJson - arduinojson.org
  2. # Copyright Benoit Blanchon 2014-2019
  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. -Wno-vla # Allow VLA in tests
  38. )
  39. add_definitions(-DHAS_VARIABLE_LENGTH_ARRAY)
  40. if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.5)
  41. add_compile_options(-Wlogical-op) # the flag exists in 4.4 but is buggy
  42. endif()
  43. if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.6)
  44. add_compile_options(-Wnoexcept)
  45. endif()
  46. endif()
  47. if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  48. add_compile_options(
  49. -Wc++11-compat
  50. -Wdeprecated-register
  51. -Wno-vla-extension # Allow VLA in tests
  52. )
  53. add_definitions(
  54. -DHAS_VARIABLE_LENGTH_ARRAY
  55. -DSUBSCRIPT_CONFLICTS_WITH_BUILTIN_OPERATOR
  56. )
  57. endif()
  58. if(MSVC)
  59. add_definitions(-D_CRT_SECURE_NO_WARNINGS)
  60. add_compile_options(
  61. /W4 # Set warning level
  62. /WX # Treats all compiler warnings as errors.
  63. )
  64. endif()
  65. add_subdirectory(ElementProxy)
  66. add_subdirectory(IntegrationTests)
  67. add_subdirectory(JsonArray)
  68. add_subdirectory(JsonDeserializer)
  69. add_subdirectory(JsonDocument)
  70. add_subdirectory(JsonObject)
  71. add_subdirectory(JsonSerializer)
  72. add_subdirectory(JsonVariant)
  73. add_subdirectory(MemberProxy)
  74. add_subdirectory(MemoryPool)
  75. add_subdirectory(Misc)
  76. add_subdirectory(MixedConfiguration)
  77. add_subdirectory(MsgPackDeserializer)
  78. add_subdirectory(MsgPackSerializer)
  79. add_subdirectory(Numbers)
  80. add_subdirectory(TextFormatter)