diff -up ./CMakeLists.txt.offline ./CMakeLists.txt --- ./CMakeLists.txt.offline 2025-06-19 23:11:29.000000000 +0200 +++ ./CMakeLists.txt 2025-08-06 15:07:48.607390466 +0200 @@ -69,6 +69,13 @@ else() endif() endif() +if(VALKEY_INCLUDE_DIR) + if(ENABLE_UNIT_TESTS OR ENABLE_INTEGRATION_TESTS) + message(FATAL_ERROR "Incompatible option VALKEY_INCLUDE_DIR with ENABLE_UNIT_TESTS or ENABLE_INTEGRATION_TESTS") + endif() + file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/include") + file(COPY_FILE "${VALKEY_INCLUDE_DIR}/valkeymodule.h" "${CMAKE_CURRENT_SOURCE_DIR}/src/include/valkeymodule.h") +else() ExternalProject_Add( valkey GIT_REPOSITORY https://github.com/valkey-io/valkey.git @@ -94,6 +101,7 @@ ExternalProject_Add_Step( COMMAND ${CMAKE_COMMAND} -E copy ${VALKEY_DOWNLOAD_DIR}/src/valkey/src/valkeymodule.h ${VALKEY_INCLUDE_DIR}/valkeymodule.h ALWAYS 1 ) +endif() # Integration tests require the valkey-test-framework which is only needed when # building Valkey from source. @@ -171,11 +179,18 @@ message("CMAKE_C_FLAGS: ${CMAKE_C_FLAGS} message("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") # Fetch RapidJSON +if(RAPIDJSON_SOURCE_DIR) +FetchContent_Declare( + rapidjson + SOURCE_DIR "${RAPIDJSON_SOURCE_DIR}" +) +else() FetchContent_Declare( rapidjson GIT_REPOSITORY https://github.com/Tencent/rapidjson.git GIT_TAG ebd87cb468fb4cb060b37e579718c4a4125416c1 ) +endif() # Disable RapidJSON tests and examples set(RAPIDJSON_BUILD_TESTS OFF CACHE BOOL "Build rapidjson tests" FORCE) diff -up ./src/CMakeLists.txt.offline ./src/CMakeLists.txt --- ./src/CMakeLists.txt.offline 2025-06-19 23:11:29.000000000 +0200 +++ ./src/CMakeLists.txt 2025-08-06 15:09:25.030234068 +0200 @@ -39,4 +39,7 @@ target_sources(${OBJECT_TARGET} ) add_library(${JSON_MODULE_LIB} SHARED $) + +if(ENABLE_UNIT_TESTS OR ENABLE_INTEGRATION_TESTS) add_dependencies(${OBJECT_TARGET} valkey) +endif()