diff -up ./CMakeLists.txt.old ./CMakeLists.txt --- ./CMakeLists.txt.old 2025-08-06 09:38:41.575001413 +0200 +++ ./CMakeLists.txt 2025-08-06 10:49:15.720138781 +0200 @@ -69,6 +69,10 @@ else() endif() endif() +if(BUILD_RELEASE) + file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/include") + file(COPY_FILE "/usr/include/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 +98,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 +176,18 @@ message("CMAKE_C_FLAGS: ${CMAKE_C_FLAGS} message("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") # Fetch RapidJSON +if(BUILD_RELEASE) +FetchContent_Declare( + rapidjson + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/rapidjson-ebd87cb468fb4cb060b37e579718c4a4125416c1" +) +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.old ./src/CMakeLists.txt --- ./src/CMakeLists.txt.old 2025-08-06 09:46:37.672820317 +0200 +++ ./src/CMakeLists.txt 2025-08-06 09:46:46.976759840 +0200 @@ -39,4 +39,3 @@ target_sources(${OBJECT_TARGET} ) add_library(${JSON_MODULE_LIB} SHARED $) -add_dependencies(${OBJECT_TARGET} valkey)