mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 00:32:37 +01:00 
			
		
		
		
	Reformat CMake files
This commit is contained in:
		
							
								
								
									
										6
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							| @@ -10,5 +10,9 @@ | ||||
|   }, | ||||
|   "C_Cpp.default.includePath": [ | ||||
|     "/src" | ||||
|   ] | ||||
|   ], | ||||
|   "[cmake]": { | ||||
|     "editor.detectIndentation": false, | ||||
|     "editor.insertSpaces": false, | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -5,15 +5,15 @@ | ||||
| cmake_minimum_required(VERSION 3.15) | ||||
|  | ||||
| if(ESP_PLATFORM) | ||||
|    # Build ArduinoJson as an ESP-IDF component | ||||
|    idf_component_register(INCLUDE_DIRS src) | ||||
|    return() | ||||
| 	# Build ArduinoJson as an ESP-IDF component | ||||
| 	idf_component_register(INCLUDE_DIRS src) | ||||
| 	return() | ||||
| endif() | ||||
|  | ||||
| project(ArduinoJson VERSION 6.20.1) | ||||
|  | ||||
| if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) | ||||
|     include(CTest) | ||||
| 	include(CTest) | ||||
| endif() | ||||
|  | ||||
| add_subdirectory(src) | ||||
|   | ||||
| @@ -27,11 +27,10 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") | ||||
| 	if(${COVERAGE}) | ||||
| 		set(CMAKE_CXX_FLAGS "-fprofile-arcs -ftest-coverage") | ||||
| 	endif() | ||||
|  | ||||
| endif() | ||||
|  | ||||
| if(CMAKE_CXX_COMPILER_ID STREQUAL  "GNU") | ||||
| 	if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.8) AND (NOT ${COVERAGE})) | ||||
| if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | ||||
| 	if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.8) AND(NOT ${COVERAGE})) | ||||
| 		add_compile_options(-g -Og) | ||||
| 	else() | ||||
| 		add_compile_options(-g -O0) | ||||
| @@ -65,7 +64,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||||
| endif() | ||||
|  | ||||
| if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") | ||||
| 	if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.0) AND (NOT ${COVERAGE})) | ||||
| 	if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.0) AND(NOT ${COVERAGE})) | ||||
| 		add_compile_options(-g -Og) | ||||
| 	else() | ||||
| 		add_compile_options(-g -O0) | ||||
| @@ -73,7 +72,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") | ||||
| endif() | ||||
|  | ||||
| if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") | ||||
| 	if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0) AND (NOT ${COVERAGE})) | ||||
| 	if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0) AND(NOT ${COVERAGE})) | ||||
| 		add_compile_options(-g -Og) | ||||
| 	else() | ||||
| 		add_compile_options(-g -O0) | ||||
| @@ -90,7 +89,7 @@ if(MSVC) | ||||
| endif() | ||||
|  | ||||
| if(MINGW) | ||||
|   # Static link on MinGW to avoid linking with the wrong DLLs when multiple | ||||
| 	# Static link on MinGW to avoid linking with the wrong DLLs when multiple | ||||
| 	# versions are installed. | ||||
| 	add_link_options(-static) | ||||
| endif() | ||||
|   | ||||
| @@ -2,5 +2,7 @@ | ||||
| # Copyright © 2014-2022, Benoit BLANCHON | ||||
| # MIT License | ||||
|  | ||||
| idf_component_register(SRCS "main.cpp" | ||||
|                        INCLUDE_DIRS "") | ||||
| idf_component_register( | ||||
| 	SRCS "main.cpp" | ||||
| 	INCLUDE_DIRS "" | ||||
| ) | ||||
|   | ||||
| @@ -22,7 +22,7 @@ target_link_libraries(json_reproducer | ||||
| 	ArduinoJson | ||||
| ) | ||||
|  | ||||
| macro(add_fuzzer name)	 | ||||
| macro(add_fuzzer name) | ||||
| 	set(FUZZER "${name}_fuzzer") | ||||
| 	set(CORPUS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${name}_corpus") | ||||
| 	set(SEED_CORPUS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${name}_seed_corpus") | ||||
| @@ -33,27 +33,23 @@ macro(add_fuzzer name) | ||||
| 		ArduinoJson | ||||
| 	) | ||||
| 	set_target_properties("${FUZZER}" | ||||
| 		PROPERTIES  | ||||
| 			COMPILE_FLAGS   | ||||
| 				"-fprofile-instr-generate -fcoverage-mapping -fsanitize=fuzzer -fno-sanitize-recover=all" | ||||
| 			LINK_FLAGS | ||||
| 				"-fprofile-instr-generate -fcoverage-mapping -fsanitize=fuzzer -fno-sanitize-recover=all" | ||||
| 		PROPERTIES | ||||
| 			COMPILE_FLAGS "-fprofile-instr-generate -fcoverage-mapping -fsanitize=fuzzer -fno-sanitize-recover=all" | ||||
| 			LINK_FLAGS "-fprofile-instr-generate -fcoverage-mapping -fsanitize=fuzzer -fno-sanitize-recover=all" | ||||
| 	) | ||||
|  | ||||
| 	add_test( | ||||
| 		NAME | ||||
| 			"${FUZZER}" | ||||
| 		COMMAND | ||||
| 			"${FUZZER}" "${CORPUS_DIR}" "${SEED_CORPUS_DIR}" -max_total_time=5 -timeout=1 | ||||
| 		NAME "${FUZZER}" | ||||
| 		COMMAND "${FUZZER}" "${CORPUS_DIR}" "${SEED_CORPUS_DIR}" -max_total_time=5 -timeout=1 | ||||
| 	) | ||||
|  | ||||
| 	set_tests_properties("${FUZZER}" | ||||
| 		PROPERTIES | ||||
| 			LABELS 		"Fuzzing" | ||||
| 		LABELS "Fuzzing" | ||||
| 	) | ||||
| endmacro() | ||||
|  | ||||
| if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6) | ||||
| if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6) | ||||
| 	add_fuzzer(json) | ||||
| 	add_fuzzer(msgpack) | ||||
| endif() | ||||
|   | ||||
| @@ -25,5 +25,5 @@ add_test(Cpp17 Cpp17Tests) | ||||
|  | ||||
| set_tests_properties(Cpp17 | ||||
| 	PROPERTIES | ||||
| 		LABELS 		"Catch" | ||||
| 		LABELS "Catch" | ||||
| ) | ||||
|   | ||||
| @@ -25,5 +25,5 @@ add_test(Cpp20 Cpp20Tests) | ||||
|  | ||||
| set_tests_properties(Cpp20 | ||||
| 	PROPERTIES | ||||
| 		LABELS 		"Catch" | ||||
| 		LABELS "Catch" | ||||
| ) | ||||
|   | ||||
| @@ -5,25 +5,21 @@ | ||||
| macro(build_should_fail target) | ||||
| 	set_target_properties(${target} | ||||
| 		PROPERTIES | ||||
| 	    	EXCLUDE_FROM_ALL TRUE | ||||
| 	        EXCLUDE_FROM_DEFAULT_BUILD TRUE | ||||
| 			EXCLUDE_FROM_ALL TRUE | ||||
| 			EXCLUDE_FROM_DEFAULT_BUILD TRUE | ||||
| 	) | ||||
| 	add_test( | ||||
| 		NAME | ||||
| 			${target} | ||||
| 	    COMMAND | ||||
| 	    	${CMAKE_COMMAND} --build . --target ${target} --config $<CONFIGURATION> | ||||
| 	    WORKING_DIRECTORY | ||||
| 	    	${CMAKE_BINARY_DIR} | ||||
| 		NAME ${target} | ||||
| 			COMMAND ${CMAKE_COMMAND} --build . --target ${target} --config $<CONFIGURATION> | ||||
| 			WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | ||||
| 	) | ||||
| 	set_tests_properties(${target}  | ||||
| 	set_tests_properties(${target} | ||||
| 		PROPERTIES | ||||
| 			WILL_FAIL	TRUE | ||||
| 			LABELS 		"WillFail;Catch" | ||||
| 			WILL_FAIL TRUE | ||||
| 			LABELS "WillFail;Catch" | ||||
| 	) | ||||
| endmacro() | ||||
|  | ||||
|  | ||||
| add_executable(Issue978 Issue978.cpp) | ||||
| build_should_fail(Issue978) | ||||
|  | ||||
|   | ||||
| @@ -12,7 +12,7 @@ add_executable(IntegrationTests | ||||
| if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") | ||||
| 	target_compile_options(IntegrationTests | ||||
| 		PUBLIC | ||||
| 		-fsingle-precision-constant # issue 544 | ||||
| 			-fsingle-precision-constant # issue 544 | ||||
| 	) | ||||
| endif() | ||||
|  | ||||
| @@ -20,5 +20,5 @@ add_test(IntegrationTests IntegrationTests) | ||||
|  | ||||
| set_tests_properties(IntegrationTests | ||||
| 	PROPERTIES | ||||
| 		LABELS 		"Catch" | ||||
| 		LABELS "Catch" | ||||
| ) | ||||
|   | ||||
| @@ -24,5 +24,5 @@ add_test(JsonArray JsonArrayTests) | ||||
|  | ||||
| set_tests_properties(JsonArray | ||||
| 	PROPERTIES | ||||
| 		LABELS 		"Catch" | ||||
| 		LABELS "Catch" | ||||
| ) | ||||
|   | ||||
| @@ -24,5 +24,5 @@ add_test(JsonDeserializer JsonDeserializerTests) | ||||
|  | ||||
| set_tests_properties(JsonDeserializer | ||||
| 	PROPERTIES | ||||
| 		LABELS 		"Catch" | ||||
| 		LABELS "Catch" | ||||
| ) | ||||
|   | ||||
| @@ -28,5 +28,5 @@ add_test(JsonDocument JsonDocumentTests) | ||||
|  | ||||
| set_tests_properties(JsonDocument | ||||
| 	PROPERTIES | ||||
| 		LABELS 		"Catch" | ||||
| 		LABELS "Catch" | ||||
| ) | ||||
|   | ||||
| @@ -25,5 +25,5 @@ add_test(JsonObject JsonObjectTests) | ||||
|  | ||||
| set_tests_properties(JsonObject | ||||
| 	PROPERTIES | ||||
| 		LABELS 		"Catch" | ||||
| 		LABELS "Catch" | ||||
| ) | ||||
|   | ||||
| @@ -18,5 +18,5 @@ add_test(JsonSerializer JsonSerializerTests) | ||||
|  | ||||
| set_tests_properties(JsonSerializer | ||||
| 	PROPERTIES | ||||
| 		LABELS 		"Catch" | ||||
| 		LABELS "Catch" | ||||
| ) | ||||
|   | ||||
| @@ -33,5 +33,5 @@ add_test(JsonVariant JsonVariantTests) | ||||
|  | ||||
| set_tests_properties(JsonVariant | ||||
| 	PROPERTIES | ||||
| 		LABELS 		"Catch" | ||||
| 		LABELS "Catch" | ||||
| ) | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
| # Copyright © 2014-2022, Benoit BLANCHON | ||||
| # MIT License | ||||
|  | ||||
| add_executable(MemoryPoolTests  | ||||
| add_executable(MemoryPoolTests | ||||
| 	allocVariant.cpp | ||||
| 	clear.cpp | ||||
| 	saveString.cpp | ||||
| @@ -14,5 +14,5 @@ add_test(MemoryPool MemoryPoolTests) | ||||
|  | ||||
| set_tests_properties(MemoryPool | ||||
| 	PROPERTIES | ||||
| 		LABELS 		"Catch" | ||||
| 		LABELS "Catch" | ||||
| ) | ||||
|   | ||||
| @@ -25,5 +25,5 @@ add_test(Misc MiscTests) | ||||
|  | ||||
| set_tests_properties(Misc | ||||
| 	PROPERTIES | ||||
| 		LABELS 		"Catch" | ||||
| 		LABELS "Catch" | ||||
| ) | ||||
|   | ||||
| @@ -29,5 +29,5 @@ add_test(MixedConfiguration MixedConfigurationTests) | ||||
|  | ||||
| set_tests_properties(MixedConfiguration | ||||
| 	PROPERTIES | ||||
| 		LABELS 		"Catch" | ||||
| 		LABELS "Catch" | ||||
| ) | ||||
|   | ||||
| @@ -20,5 +20,5 @@ add_test(MsgPackDeserializer MsgPackDeserializerTests) | ||||
|  | ||||
| set_tests_properties(MsgPackDeserializer | ||||
| 	PROPERTIES | ||||
| 		LABELS 		"Catch" | ||||
| 		LABELS "Catch" | ||||
| ) | ||||
|   | ||||
| @@ -15,5 +15,5 @@ add_test(MsgPackSerializer MsgPackSerializerTests) | ||||
|  | ||||
| set_tests_properties(MsgPackSerializer | ||||
| 	PROPERTIES | ||||
| 		LABELS 		"Catch" | ||||
| 		LABELS "Catch" | ||||
| ) | ||||
|   | ||||
| @@ -10,10 +10,9 @@ add_executable(NumbersTests | ||||
| 	parseNumber.cpp | ||||
| ) | ||||
|  | ||||
|  | ||||
| add_test(Numbers NumbersTests) | ||||
|  | ||||
| set_tests_properties(Numbers | ||||
| 	PROPERTIES | ||||
| 		LABELS 		"Catch" | ||||
| 		LABELS "Catch" | ||||
| ) | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
| # Copyright © 2014-2022, Benoit BLANCHON | ||||
| # MIT License | ||||
|  | ||||
| add_executable(TextFormatterTests  | ||||
| add_executable(TextFormatterTests | ||||
| 	writeFloat.cpp | ||||
| 	writeInteger.cpp | ||||
| 	writeString.cpp | ||||
| @@ -14,5 +14,5 @@ add_test(TextFormatter TextFormatterTests) | ||||
|  | ||||
| set_tests_properties(TextFormatter | ||||
| 	PROPERTIES | ||||
| 		LABELS 		"Catch" | ||||
| 		LABELS "Catch" | ||||
| ) | ||||
|   | ||||
| @@ -12,7 +12,7 @@ add_library(catch | ||||
|  | ||||
| target_include_directories(catch | ||||
| 	PUBLIC | ||||
| 	${CMAKE_CURRENT_SOURCE_DIR} | ||||
| 		${CMAKE_CURRENT_SOURCE_DIR} | ||||
| ) | ||||
|  | ||||
| if(MINGW) | ||||
|   | ||||
| @@ -12,79 +12,80 @@ include(GNUInstallDirs) | ||||
| # Adding the install interface generator expression makes sure that the include | ||||
| # files are installed to the proper location (provided by GNUInstallDirs) | ||||
| target_include_directories(ArduinoJson | ||||
|     INTERFACE | ||||
|         $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> | ||||
|         $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> | ||||
| 	INTERFACE | ||||
| 		$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> | ||||
| 		$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> | ||||
| ) | ||||
|  | ||||
| target_compile_definitions(ArduinoJson | ||||
|     INTERFACE | ||||
|         ARDUINOJSON_DEBUG=$<CONFIG:Debug> | ||||
| 	INTERFACE | ||||
| 		ARDUINOJSON_DEBUG=$<CONFIG:Debug> | ||||
| ) | ||||
|  | ||||
| # locations are provided by GNUInstallDirs | ||||
| install( | ||||
|     TARGETS | ||||
|         ArduinoJson | ||||
|     EXPORT | ||||
|         ArduinoJson_Targets | ||||
|     ARCHIVE DESTINATION | ||||
|         ${CMAKE_INSTALL_LIBDIR} | ||||
|     LIBRARY DESTINATION | ||||
|         ${CMAKE_INSTALL_LIBDIR} | ||||
|     RUNTIME DESTINATION | ||||
|         ${CMAKE_INSTALL_BINDIR} | ||||
| 	TARGETS | ||||
| 		ArduinoJson | ||||
| 	EXPORT | ||||
| 		ArduinoJson_Targets | ||||
| 	ARCHIVE DESTINATION | ||||
| 		${CMAKE_INSTALL_LIBDIR} | ||||
| 	LIBRARY DESTINATION | ||||
| 		${CMAKE_INSTALL_LIBDIR} | ||||
| 	RUNTIME DESTINATION | ||||
| 		${CMAKE_INSTALL_BINDIR} | ||||
| ) | ||||
|  | ||||
| include(CMakePackageConfigHelpers) | ||||
|  | ||||
| if(${CMAKE_VERSION} VERSION_GREATER "3.14.0")  | ||||
|     set(ARCH_INDEPENDENT "ARCH_INDEPENDENT") | ||||
| if(${CMAKE_VERSION} VERSION_GREATER "3.14.0") | ||||
| 	set(ARCH_INDEPENDENT "ARCH_INDEPENDENT") | ||||
| endif() | ||||
|  | ||||
| write_basic_package_version_file( | ||||
|         "${PROJECT_BINARY_DIR}/ArduinoJsonConfigVersion.cmake" | ||||
|     VERSION | ||||
|         ${PROJECT_VERSION} | ||||
|     COMPATIBILITY | ||||
|         SameMajorVersion | ||||
|     ${ARCH_INDEPENDENT} | ||||
| 		"${PROJECT_BINARY_DIR}/ArduinoJsonConfigVersion.cmake" | ||||
| 	VERSION | ||||
| 		${PROJECT_VERSION} | ||||
| 	COMPATIBILITY | ||||
| 		SameMajorVersion | ||||
| 	${ARCH_INDEPENDENT} | ||||
| ) | ||||
|  | ||||
| configure_package_config_file( | ||||
|         "${PROJECT_SOURCE_DIR}/extras/ArduinoJsonConfig.cmake.in" | ||||
|         "${PROJECT_BINARY_DIR}/ArduinoJsonConfig.cmake" | ||||
|     INSTALL_DESTINATION | ||||
|         ${CMAKE_INSTALL_DATAROOTDIR}/ArduinoJson/cmake) | ||||
|  | ||||
| install( | ||||
|     EXPORT | ||||
|         ArduinoJson_Targets | ||||
|     FILE | ||||
|         ArduinoJsonTargets.cmake | ||||
|     DESTINATION | ||||
|         ${CMAKE_INSTALL_DATAROOTDIR}/ArduinoJson/cmake | ||||
| 		"${PROJECT_SOURCE_DIR}/extras/ArduinoJsonConfig.cmake.in" | ||||
| 		"${PROJECT_BINARY_DIR}/ArduinoJsonConfig.cmake" | ||||
| 	INSTALL_DESTINATION | ||||
| 		${CMAKE_INSTALL_DATAROOTDIR}/ArduinoJson/cmake | ||||
| ) | ||||
|  | ||||
| install( | ||||
|     FILES | ||||
|         "${PROJECT_BINARY_DIR}/ArduinoJsonConfig.cmake" | ||||
|         "${PROJECT_BINARY_DIR}/ArduinoJsonConfigVersion.cmake" | ||||
|     DESTINATION | ||||
|         "${CMAKE_INSTALL_DATAROOTDIR}/ArduinoJson/cmake" | ||||
| 	EXPORT | ||||
| 		ArduinoJson_Targets | ||||
| 	FILE | ||||
| 		ArduinoJsonTargets.cmake | ||||
| 	DESTINATION | ||||
| 		${CMAKE_INSTALL_DATAROOTDIR}/ArduinoJson/cmake | ||||
| ) | ||||
|  | ||||
| install( | ||||
|     FILES | ||||
|         ArduinoJson.h | ||||
|         ArduinoJson.hpp | ||||
|     DESTINATION | ||||
|         include | ||||
| 	FILES | ||||
| 		"${PROJECT_BINARY_DIR}/ArduinoJsonConfig.cmake" | ||||
| 		"${PROJECT_BINARY_DIR}/ArduinoJsonConfigVersion.cmake" | ||||
| 	DESTINATION | ||||
| 		"${CMAKE_INSTALL_DATAROOTDIR}/ArduinoJson/cmake" | ||||
| ) | ||||
|  | ||||
| install( | ||||
|     DIRECTORY | ||||
|         "${CMAKE_CURRENT_SOURCE_DIR}/ArduinoJson" | ||||
|     DESTINATION | ||||
|         include | ||||
| 	FILES | ||||
| 		ArduinoJson.h | ||||
| 		ArduinoJson.hpp | ||||
| 	DESTINATION | ||||
| 		include | ||||
| ) | ||||
|  | ||||
| install( | ||||
| 	DIRECTORY | ||||
| 		"${CMAKE_CURRENT_SOURCE_DIR}/ArduinoJson" | ||||
| 	DESTINATION | ||||
| 		include | ||||
| ) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user