mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 00:32:37 +01:00 
			
		
		
		
	Added CMake "install" target (closes #1209)
This commit is contained in:
		| @@ -7,6 +7,7 @@ HEAD | ||||
| * Fixed "maybe-uninitialized" warning (issue #1217) | ||||
| * Fixed "statement is unreachable" warning on IAR (issue #1233) | ||||
| * Fixed "pointless integer comparison" warning on IAR (issue #1233) | ||||
| * Added CMake "install" target (issue #1209) | ||||
|  | ||||
| v6.15.0 (2020-03-22) | ||||
| ------- | ||||
|   | ||||
| @@ -5,6 +5,8 @@ | ||||
| cmake_minimum_required(VERSION 3.0) | ||||
| project(ArduinoJson) | ||||
|  | ||||
| set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true) | ||||
|  | ||||
| enable_testing() | ||||
|  | ||||
| add_definitions(-DARDUINOJSON_DEBUG=1) | ||||
| @@ -37,6 +39,6 @@ if(${COVERAGE}) | ||||
| 	set(CMAKE_CXX_FLAGS "-fprofile-arcs -ftest-coverage") | ||||
| endif() | ||||
|  | ||||
| include_directories(${CMAKE_CURRENT_LIST_DIR}/src) | ||||
| add_subdirectory(src) | ||||
| add_subdirectory(extras/tests) | ||||
| add_subdirectory(extras/fuzzing) | ||||
|   | ||||
							
								
								
									
										4
									
								
								extras/ArduinoJsonConfig.cmake.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								extras/ArduinoJsonConfig.cmake.in
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| @PACKAGE_INIT@ | ||||
|  | ||||
| include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") | ||||
| check_required_components("@PROJECT_NAME@") | ||||
| @@ -10,8 +10,14 @@ add_executable(msgpack_fuzzer | ||||
| 	msgpack_fuzzer.cpp | ||||
| 	fuzzer_main.cpp | ||||
| ) | ||||
| target_link_libraries(msgpack_fuzzer | ||||
| 	ArduinoJson | ||||
| ) | ||||
|  | ||||
| add_executable(json_fuzzer | ||||
| 	json_fuzzer.cpp | ||||
| 	fuzzer_main.cpp | ||||
| ) | ||||
| target_link_libraries(json_fuzzer | ||||
| 	ArduinoJson | ||||
| ) | ||||
|   | ||||
| @@ -11,5 +11,9 @@ add_executable(ElementProxyTests | ||||
| 	size.cpp | ||||
| ) | ||||
|  | ||||
| target_link_libraries(ElementProxyTests catch) | ||||
| target_link_libraries(ElementProxyTests | ||||
| 	ArduinoJson | ||||
| 	catch | ||||
| ) | ||||
|  | ||||
| add_test(ElementProxy ElementProxyTests) | ||||
|   | ||||
| @@ -16,5 +16,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") | ||||
| 	) | ||||
| endif() | ||||
|  | ||||
| target_link_libraries(IntegrationTests catch) | ||||
| target_link_libraries(IntegrationTests | ||||
| 	ArduinoJson | ||||
| 	catch | ||||
| ) | ||||
|  | ||||
| add_test(IntegrationTests IntegrationTests) | ||||
|   | ||||
| @@ -19,5 +19,9 @@ add_executable(JsonArrayTests | ||||
| 	undefined.cpp | ||||
| ) | ||||
|  | ||||
| target_link_libraries(JsonArrayTests catch) | ||||
| target_link_libraries(JsonArrayTests | ||||
| 	ArduinoJson | ||||
| 	catch | ||||
| ) | ||||
|  | ||||
| add_test(JsonArray JsonArrayTests) | ||||
|   | ||||
| @@ -18,7 +18,11 @@ add_executable(JsonDeserializerTests | ||||
| 	string.cpp | ||||
| ) | ||||
|  | ||||
| target_link_libraries(JsonDeserializerTests catch) | ||||
| target_link_libraries(JsonDeserializerTests | ||||
| 	ArduinoJson | ||||
| 	catch | ||||
| ) | ||||
|  | ||||
| set_target_properties(JsonDeserializerTests PROPERTIES UNITY_BUILD OFF) | ||||
|  | ||||
| add_test(JsonDeserializer JsonDeserializerTests) | ||||
|   | ||||
| @@ -18,5 +18,9 @@ add_executable(JsonDocumentTests | ||||
| 	subscript.cpp | ||||
| ) | ||||
|  | ||||
| target_link_libraries(JsonDocumentTests catch) | ||||
| target_link_libraries(JsonDocumentTests | ||||
| 	ArduinoJson | ||||
| 	catch | ||||
| ) | ||||
|  | ||||
| add_test(JsonDocument JsonDocumentTests) | ||||
|   | ||||
| @@ -19,5 +19,9 @@ add_executable(JsonObjectTests | ||||
| 	subscript.cpp | ||||
| ) | ||||
|  | ||||
| target_link_libraries(JsonObjectTests catch) | ||||
| target_link_libraries(JsonObjectTests | ||||
| 	ArduinoJson | ||||
| 	catch | ||||
| ) | ||||
|  | ||||
| add_test(JsonObject JsonObjectTests) | ||||
|   | ||||
| @@ -14,5 +14,9 @@ add_executable(JsonSerializerTests | ||||
| 	std_string.cpp | ||||
| ) | ||||
|  | ||||
| target_link_libraries(JsonSerializerTests catch) | ||||
| target_link_libraries(JsonSerializerTests | ||||
| 	ArduinoJson | ||||
| 	catch | ||||
| ) | ||||
|  | ||||
| add_test(JsonSerializer JsonSerializerTests) | ||||
|   | ||||
| @@ -24,5 +24,9 @@ add_executable(JsonVariantTests | ||||
| 	undefined.cpp | ||||
| ) | ||||
|  | ||||
| target_link_libraries(JsonVariantTests catch) | ||||
| target_link_libraries(JsonVariantTests | ||||
| 	ArduinoJson | ||||
| 	catch | ||||
| ) | ||||
|  | ||||
| add_test(JsonVariant JsonVariantTests) | ||||
|   | ||||
| @@ -13,5 +13,9 @@ add_executable(MemberProxyTests | ||||
| 	subscript.cpp | ||||
| ) | ||||
|  | ||||
| target_link_libraries(MemberProxyTests catch) | ||||
| target_link_libraries(MemberProxyTests | ||||
| 	ArduinoJson | ||||
| 	catch | ||||
| ) | ||||
|  | ||||
| add_test(MemberProxy MemberProxyTests) | ||||
|   | ||||
| @@ -10,5 +10,9 @@ add_executable(MemoryPoolTests | ||||
| 	StringBuilder.cpp | ||||
| ) | ||||
|  | ||||
| target_link_libraries(MemoryPoolTests catch) | ||||
| target_link_libraries(MemoryPoolTests | ||||
| 	ArduinoJson | ||||
| 	catch | ||||
| ) | ||||
|  | ||||
| add_test(MemoryPool MemoryPoolTests) | ||||
|   | ||||
| @@ -15,7 +15,11 @@ add_executable(MiscTests | ||||
| 	version.cpp | ||||
| ) | ||||
|  | ||||
| target_link_libraries(MiscTests catch) | ||||
| target_link_libraries(MiscTests | ||||
| 	ArduinoJson | ||||
| 	catch | ||||
| ) | ||||
|  | ||||
| set_target_properties(MiscTests PROPERTIES UNITY_BUILD OFF) | ||||
|  | ||||
| add_test(Misc MiscTests) | ||||
|   | ||||
| @@ -22,7 +22,11 @@ add_executable(MixedConfigurationTests | ||||
| 	enable_comments_0.cpp | ||||
| ) | ||||
|  | ||||
| target_link_libraries(MixedConfigurationTests catch) | ||||
| target_link_libraries(MixedConfigurationTests | ||||
| 	ArduinoJson | ||||
| 	catch | ||||
| ) | ||||
|  | ||||
| set_target_properties(MixedConfigurationTests PROPERTIES UNITY_BUILD OFF) | ||||
|  | ||||
| add_test(MixedConfiguration MixedConfigurationTests) | ||||
|   | ||||
| @@ -14,5 +14,9 @@ add_executable(MsgPackDeserializerTests | ||||
| 	notSupported.cpp | ||||
| ) | ||||
|  | ||||
| target_link_libraries(MsgPackDeserializerTests catch) | ||||
| target_link_libraries(MsgPackDeserializerTests | ||||
| 	ArduinoJson | ||||
| 	catch | ||||
| ) | ||||
|  | ||||
| add_test(MsgPackDeserializer MsgPackDeserializerTests) | ||||
|   | ||||
| @@ -11,5 +11,9 @@ add_executable(MsgPackSerializerTests | ||||
| 	serializeVariant.cpp | ||||
| ) | ||||
|  | ||||
| target_link_libraries(MsgPackSerializerTests catch) | ||||
| target_link_libraries(MsgPackSerializerTests | ||||
| 	ArduinoJson | ||||
| 	catch | ||||
| ) | ||||
|  | ||||
| add_test(MsgPackSerializer MsgPackSerializerTests) | ||||
|   | ||||
| @@ -8,6 +8,10 @@ add_executable(NumbersTests | ||||
| 	parseNumber.cpp | ||||
| ) | ||||
|  | ||||
| target_link_libraries(NumbersTests catch) | ||||
| target_link_libraries(NumbersTests | ||||
| 	ArduinoJson | ||||
| 	catch | ||||
| ) | ||||
|  | ||||
|  | ||||
| add_test(Numbers NumbersTests) | ||||
|   | ||||
| @@ -7,7 +7,11 @@ add_executable(TextFormatterTests | ||||
| 	writeString.cpp | ||||
| ) | ||||
|  | ||||
| target_link_libraries(TextFormatterTests catch) | ||||
| target_link_libraries(TextFormatterTests | ||||
| 	ArduinoJson | ||||
| 	catch | ||||
| ) | ||||
|  | ||||
| set_target_properties(TextFormatterTests PROPERTIES UNITY_BUILD OFF) | ||||
|  | ||||
| add_test(TextFormatter TextFormatterTests) | ||||
|   | ||||
							
								
								
									
										79
									
								
								src/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								src/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,79 @@ | ||||
| # ArduinoJson - arduinojson.org | ||||
| # Copyright Benoit Blanchon 2014-2020 | ||||
| # MIT License | ||||
|  | ||||
| # I have no idea what this is about, I simply followed the instructions from: | ||||
| # https://dominikberner.ch/cmake-interface-lib/ | ||||
|  | ||||
| add_library(ArduinoJson INTERFACE) | ||||
|  | ||||
| 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}> | ||||
| ) | ||||
|  | ||||
| # 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} | ||||
| ) | ||||
|  | ||||
| include(CMakePackageConfigHelpers) | ||||
| write_basic_package_version_file( | ||||
|         "${PROJECT_BINARY_DIR}/ArduinoJsonConfigVersion.cmake" | ||||
|     VERSION | ||||
|         6.15.0 | ||||
|     COMPATIBILITY | ||||
|         SameMajorVersion | ||||
| ) | ||||
|  | ||||
| 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 | ||||
| ) | ||||
|  | ||||
| install( | ||||
|     FILES | ||||
|         "${PROJECT_BINARY_DIR}/ArduinoJsonConfig.cmake" | ||||
|         "${PROJECT_BINARY_DIR}/ArduinoJsonConfigVersion.cmake" | ||||
|     DESTINATION | ||||
|         "${CMAKE_INSTALL_DATAROOTDIR}/ArduinoJson/cmake" | ||||
| ) | ||||
|  | ||||
| install( | ||||
|     FILES | ||||
|         ArduinoJson.h | ||||
|         ArduinoJson.hpp | ||||
|     DESTINATION | ||||
|         include | ||||
| ) | ||||
|  | ||||
| install( | ||||
|     DIRECTORY | ||||
|         "${CMAKE_CURRENT_SOURCE_DIR}/ArduinoJson" | ||||
|     DESTINATION | ||||
|         include | ||||
| ) | ||||
		Reference in New Issue
	
	Block a user