# # Custom Rapidjson usage. # # To build without the memory optimization using the CrtAllocator run with the option, # cmake # -DRAPIDJSON_MEM_OPTIMIZATION=OFF # # To build with custom memory settings run with the option, # cmake # -DRAPIDJSON_MEM_OPTIMIZATION=CUSTOM # -DRAPIDJSON_DEFAULT_ALLOCATOR= # -DRAPIDJSON_VALUE_DEFAULT_OBJECT_CAPACITY= # -DRAPIDJSON_VALUE_DEFAULT_ARRAY_CAPACITY= # -DRAPIDJSON_DEFAULT_STACK_ALLOCATOR= if(RAPIDJSON_MEM_OPTIMIZATION STREQUAL "OFF") # Do Nothing and let defaults take over message(STATUS "rapidjson upstream defaults used") elseif(RAPIDJSON_MEM_OPTIMIZATION STREQUAL "CUSTOM") # Use Custom values if set to custom message(STATUS "rapidjson custom values used") if(RAPIDJSON_DEFAULT_ALLOCATOR) add_definitions(-DRAPIDJSON_DEFAULT_ALLOCATOR=${RAPIDJSON_DEFAULT_ALLOCATOR}) endif() if(RAPIDJSON_VALUE_DEFAULT_OBJECT_CAPACITY) add_definitions(-DRAPIDJSON_VALUE_DEFAULT_OBJECT_CAPACITY=${RAPIDJSON_VALUE_DEFAULT_OBJECT_CAPACITY}) endif() if(RAPIDJSON_VALUE_DEFAULT_ARRAY_CAPACITY) add_definitions(-DRAPIDJSON_VALUE_DEFAULT_ARRAY_CAPACITY=${RAPIDJSON_VALUE_DEFAULT_ARRAY_CAPACITY}) endif() if(RAPIDJSON_DEFAULT_STACK_ALLOCATOR) add_definitions(-DRAPIDJSON_DEFAULT_STACK_ALLOCATOR=${RAPIDJSON_DEFAULT_STACK_ALLOCATOR}) endif() else() # Use Memory Optimization message(STATUS "rapidjson memory optimization used") add_definitions(-DRAPIDJSON_DEFAULT_ALLOCATOR=CrtAllocator) add_definitions(-DRAPIDJSON_VALUE_DEFAULT_OBJECT_CAPACITY=1) add_definitions(-DRAPIDJSON_VALUE_DEFAULT_ARRAY_CAPACITY=1) add_definitions(-DRAPIDJSON_DEFAULT_STACK_ALLOCATOR=CrtAllocator) endif()