Files
ArduinoJson/test/CMakeLists.txt

74 lines
1.5 KiB
CMake
Raw Normal View History

# Copyright Benoit Blanchon 2014-2016
# MIT License
#
# Arduino JSON library
# https://github.com/bblanchon/ArduinoJson
# If you like this project, please add a star!
include(gtest.cmake)
2014-10-16 16:23:24 +02:00
2014-10-24 18:31:50 +02:00
file(GLOB TESTS_FILES *.hpp *.cpp)
2014-10-16 16:23:24 +02:00
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
add_compile_options(
-fno-exceptions
-fno-rtti
-pedantic
-Wall
-Wcast-align
-Wcast-qual
-Wconversion
-Wctor-dtor-privacy
-Wdisabled-optimization
-Werror
-Wextra
-Wformat=2
-Winit-self
-Wmissing-include-dirs
-Wparentheses
-Wno-sign-conversion
-Wno-unused
-Wno-variadic-macros
-Wnon-virtual-dtor
-Wold-style-cast
-Woverloaded-virtual
-Wredundant-decls
-Wshadow
-Wsign-promo
-Wstrict-overflow=5
-Wundef
)
endif()
2014-10-16 16:23:24 +02:00
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_compile_options(
-Wstrict-null-sentinel
)
2014-11-15 15:09:48 +01:00
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.5)
add_compile_options(-Wlogical-op) # the flag exists in 4.4 but is buggy
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.6)
add_compile_options(-Wnoexcept)
endif()
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(
-Wc++11-compat
-Wdeprecated-register
)
endif()
2014-10-16 16:23:24 +02:00
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_compile_options(-W4)
endif()
add_executable(ArduinoJsonTests ${TESTS_FILES})
target_include_directories(ArduinoJsonTests PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../include)
target_link_libraries(ArduinoJsonTests gtest)
2014-10-16 16:23:24 +02:00
add_test(ArduinoJsonTests ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ArduinoJsonTests)