diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c77689d..9fe7c443 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,7 @@ option(PISTACHE_ENABLE_NETWORK_TESTS "if tests are built, run ones needing netwo option(PISTACHE_USE_SSL "add support for SSL server" OFF) option(PISTACHE_PIC "Enable pistache PIC" ON) # Position-independent code lib option(PISTACHE_BUILD_FUZZ "Build fuzzer for oss-fuzz" OFF) +option(PISTACHE_USE_RAPIDJSON "add support for rapidjson" ON) string(TOLOWER "${CMAKE_HOST_SYSTEM_NAME}" CMAKE_HOST_SYSTEM_NAME_LOWER) @@ -102,6 +103,10 @@ add_subdirectory (src) # For info on GTest::gtest GTest::gmock_main, see Pistache's # tests/CMakeLists.txt if (PISTACHE_BUILD_TESTS) + if (NOT PISTACHE_USE_RAPIDJSON) + message(FATAL_ERROR "Pistache tests require rapidjson support") + endif() + include(CTest) find_package(GTest QUIET) if (NOT GTEST_FOUND) @@ -123,7 +128,7 @@ if (PISTACHE_BUILD_TESTS) add_subdirectory(tests) endif() -if (PISTACHE_BUILD_FUZZ) +if (PISTACHE_BUILD_FUZZ) add_subdirectory(tests/fuzzers) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6725202f..0e15295a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -24,26 +24,28 @@ set(PISTACHE_INCLUDE $ ) -find_package(RapidJSON QUIET) -if (NOT RapidJSON_FOUND) - message("RapidJSON not found. Consider installing it on your system. Downloading it from source...") - include(FetchContent) - FetchContent_Declare( - RapidJSON - GIT_REPOSITORY https://github.com/Tencent/rapidjson.git - GIT_TAG v1.1.0 - GIT_SHALLOW true - ) - set(RAPIDJSON_BUILD_DOC OFF CACHE BOOL "") - set(RAPIDJSON_BUILD_EXAMPLES OFF CACHE BOOL "") - set(RAPIDJSON_BUILD_TESTS OFF CACHE BOOL "") - if(NOT RapidJSON_POPULATED) - FetchContent_Populate(RapidJSON) - add_subdirectory(${rapidjson_SOURCE_DIR} ${rapidjson_BINARY_DIR}) +if (PISTACHE_USE_RAPIDJSON) + find_package(RapidJSON QUIET) + if (NOT RapidJSON_FOUND) + message("RapidJSON not found. Consider installing it on your system. Downloading it from source...") + include(FetchContent) + FetchContent_Declare( + RapidJSON + GIT_REPOSITORY https://github.com/Tencent/rapidjson.git + GIT_TAG v1.1.0 + GIT_SHALLOW true + ) + set(RAPIDJSON_BUILD_DOC OFF CACHE BOOL "") + set(RAPIDJSON_BUILD_EXAMPLES OFF CACHE BOOL "") + set(RAPIDJSON_BUILD_TESTS OFF CACHE BOOL "") + if(NOT RapidJSON_POPULATED) + FetchContent_Populate(RapidJSON) + add_subdirectory(${rapidjson_SOURCE_DIR} ${rapidjson_BINARY_DIR}) + endif() + target_include_directories(pistache PRIVATE ${rapidjson_SOURCE_DIR}/include) + else() + target_include_directories(pistache PRIVATE ${RAPIDJSON_INCLUDE_DIRS}) endif() - target_include_directories(pistache PRIVATE ${rapidjson_SOURCE_DIR}/include) -else() - target_include_directories(pistache PRIVATE ${RAPIDJSON_INCLUDE_DIRS}) endif() target_include_directories(pistache PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../subprojects/hinnant-date/include) diff --git a/version.txt b/version.txt index 7f67c6c4..4f909a9c 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.5.6.20250328 +0.5.6.20250429