From 7c8eb80914132ef04abd958a29b81c0598c730f8 Mon Sep 17 00:00:00 2001 From: James Choi Date: Tue, 3 Sep 2024 16:58:11 -0400 Subject: [PATCH 1/3] Add QNX modifications --- test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test.c b/test.c index 986fc6eb..645a4736 100644 --- a/test.c +++ b/test.c @@ -25,6 +25,10 @@ #include #include "cJSON.h" +#ifdef __QNX__ +#error test +#endif + /* Used by some code below as an example datatype. */ struct record { From eb8993641f58f7d85bac084bb1fcf524627b5410 Mon Sep 17 00:00:00 2001 From: Shreya Arun Naik Date: Wed, 20 Nov 2024 15:58:03 -0500 Subject: [PATCH 2/3] Add support for QNX 7.1 and 8.0 --- CMakeLists.txt | 13 ++++++++++--- test.c | 4 ---- tests/CMakeLists.txt | 11 +++++++++++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 36a6cb57..a578d150 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,9 @@ if (ENABLE_CUSTOM_COMPILER_FLAGS) -Wused-but-marked-unused -Wswitch-enum ) + if(QNX) + list(REMOVE_ITEM custom_compiler_flags -std=c89) + endif() elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") # Disable warning c4001 - nonstandard extension 'single line comment' was used # Define _CRT_SECURE_NO_WARNINGS to disable deprecation warnings for "insecure" C library functions @@ -153,7 +156,7 @@ install(TARGETS "${CJSON_LIB}" ) if (BUILD_SHARED_AND_STATIC_LIBS) install(TARGETS "${CJSON_LIB}-static" - EXPORT "${CJSON_LIB}" + EXPORT "${CJSON_LIB}" ARCHIVE DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}" INCLUDES DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}" ) @@ -201,8 +204,8 @@ if(ENABLE_CJSON_UTILS) INCLUDES DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}" ) if (BUILD_SHARED_AND_STATIC_LIBS) - install(TARGETS "${CJSON_UTILS_LIB}-static" - EXPORT "${CJSON_UTILS_LIB}" + install(TARGETS "${CJSON_UTILS_LIB}-static" + EXPORT "${CJSON_UTILS_LIB}" ARCHIVE DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}" INCLUDES DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}" ) @@ -256,6 +259,10 @@ if(ENABLE_CJSON_TEST) endif() endif() + if(QNX) + install(TARGETS "${TEST_CJSON}" DESTINATION bin/cJSON_tests) + endif() + #"check" target that automatically builds everything and runs the tests add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure diff --git a/test.c b/test.c index 645a4736..986fc6eb 100644 --- a/test.c +++ b/test.c @@ -25,10 +25,6 @@ #include #include "cJSON.h" -#ifdef __QNX__ -#error test -#endif - /* Used by some code below as an example datatype. */ struct record { diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c7592213..a7e20203 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -88,6 +88,17 @@ if(ENABLE_CJSON_TEST) add_dependencies(check ${unity_tests}) + if(QNX) + install(DIRECTORY ${PROJECT_BINARY_DIR}/tests/ + DESTINATION bin/cJSON_tests + PATTERN "CMakeFiles" EXCLUDE + PATTERN "*.cmake" EXCLUDE + PATTERN "Makefile" EXCLUDE + PATTERN "*.a" EXCLUDE + PATTERN "*.so" EXCLUDE + ) + endif() + if (ENABLE_CJSON_UTILS) #copy test files file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/json-patch-tests") From ea34a463d86d73d8d6e6ce684d42615a8c8524e7 Mon Sep 17 00:00:00 2001 From: Shreya Arun Naik Date: Wed, 20 Nov 2024 16:12:46 -0500 Subject: [PATCH 3/3] Remove unnecessary exclusion --- tests/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a7e20203..5f65c3a8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -95,7 +95,6 @@ if(ENABLE_CJSON_TEST) PATTERN "*.cmake" EXCLUDE PATTERN "Makefile" EXCLUDE PATTERN "*.a" EXCLUDE - PATTERN "*.so" EXCLUDE ) endif()