CMakeLists.txt 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # ArduinoJson - arduinojson.org
  2. # Copyright Benoit Blanchon 2014-2019
  3. # MIT License
  4. add_subdirectory(catch)
  5. if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
  6. add_compile_options(
  7. -pedantic
  8. -Wall
  9. -Wcast-align
  10. -Wcast-qual
  11. -Wconversion
  12. -Wctor-dtor-privacy
  13. -Wdisabled-optimization
  14. -Werror
  15. -Wextra
  16. -Wformat=2
  17. -Winit-self
  18. -Wmissing-include-dirs
  19. -Wnon-virtual-dtor
  20. -Wold-style-cast
  21. -Woverloaded-virtual
  22. -Wparentheses
  23. -Wredundant-decls
  24. -Wshadow
  25. -Wsign-promo
  26. -Wstrict-aliasing
  27. -Wundef
  28. )
  29. if(NOT MINGW)
  30. add_compile_options(
  31. -std=c++98
  32. )
  33. endif()
  34. endif()
  35. if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
  36. add_compile_options(
  37. -Wstrict-null-sentinel
  38. -Wno-vla # Allow VLA in tests
  39. )
  40. add_definitions(-DHAS_VARIABLE_LENGTH_ARRAY)
  41. if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.5)
  42. add_compile_options(-Wlogical-op) # the flag exists in 4.4 but is buggy
  43. endif()
  44. if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.6)
  45. add_compile_options(-Wnoexcept)
  46. endif()
  47. endif()
  48. if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  49. add_compile_options(
  50. -Wc++11-compat
  51. -Wdeprecated-register
  52. -Wno-vla-extension # Allow VLA in tests
  53. )
  54. add_definitions(
  55. -DHAS_VARIABLE_LENGTH_ARRAY
  56. -DSUBSCRIPT_CONFLICTS_WITH_BUILTIN_OPERATOR
  57. )
  58. endif()
  59. if(MSVC)
  60. add_definitions(-D_CRT_SECURE_NO_WARNINGS)
  61. add_compile_options(
  62. /W4 # Set warning level
  63. /WX # Treats all compiler warnings as errors.
  64. )
  65. endif()
  66. include_directories(Helpers)
  67. add_subdirectory(ElementProxy)
  68. add_subdirectory(IntegrationTests)
  69. add_subdirectory(JsonArray)
  70. add_subdirectory(JsonDeserializer)
  71. add_subdirectory(JsonDocument)
  72. add_subdirectory(JsonObject)
  73. add_subdirectory(JsonSerializer)
  74. add_subdirectory(JsonVariant)
  75. add_subdirectory(MemberProxy)
  76. add_subdirectory(MemoryPool)
  77. add_subdirectory(Misc)
  78. add_subdirectory(MixedConfiguration)
  79. add_subdirectory(MsgPackDeserializer)
  80. add_subdirectory(MsgPackSerializer)
  81. add_subdirectory(Numbers)
  82. add_subdirectory(TextFormatter)