pass debug flags to redis.
@@ -6,14 +6,19 @@ include(ExternalProject)
# redis
function(add_redis REDIS_TARGET LIBOS_TARGET REDIS_SOURCE_DIR)
set(REDIS_BINARY_DIR ${CMAKE_BINARY_DIR}/ExternalProject/${REDIS_TARGET})
+ if(CMAKE_BUILD_TYPE MATCHES "Rel")
+ set(OPT_CFLAGS -O3)
+ else(CMAKE_BUILD_TYPE MATCHES "Rel")
+ set(OPT_CFLAGS -O0)
+ endif(CMAKE_BUILD_TYPE MATCHES "Rel")
# note: add `V=1` to the invocation of `make` to see what the redis build
# is actually doing.
ExternalProject_Add(${REDIS_TARGET}
PREFIX ${REDIS_BINARY_DIR}
SOURCE_DIR ${REDIS_SOURCE_DIR}
CONFIGURE_COMMAND echo "No CONFIGURE_COMMAND for target `${REDIS_TARGET}`"
- BUILD_COMMAND DEMETER_INCLUDE=${CMAKE_SOURCE_DIR}/include DEMETER_SO=$<TARGET_FILE:${LIBOS_TARGET}> make -C ${REDIS_SOURCE_DIR} MALLOC=libc PREFIX=${REDIS_BINARY_DIR}
- INSTALL_COMMAND DEMETER_INCLUDE=${CMAKE_SOURCE_DIR}/include DEMETER_SO=$<TARGET_FILE:${LIBOS_TARGET}> make -C ${REDIS_SOURCE_DIR} install MALLOC=libc PREFIX=${REDIS_BINARY_DIR}
+ BUILD_COMMAND make -C ${REDIS_SOURCE_DIR} MALLOC=libc PREFIX=${REDIS_BINARY_DIR} DEMETER_INCLUDE=${CMAKE_SOURCE_DIR}/include DEMETER_SO=$<TARGET_FILE:${LIBOS_TARGET}> OPTIMIZATION=${OPT_CFLAGS}
+ INSTALL_COMMAND make -C ${REDIS_SOURCE_DIR} install MALLOC=libc PREFIX=${REDIS_BINARY_DIR} DEMETER_INCLUDE=${CMAKE_SOURCE_DIR}/include DEMETER_SO=$<TARGET_FILE:${LIBOS_TARGET}> OPTIMIZATION=${OPT_CFLAGS}
)
add_dependencies(${REDIS_TARGET} ${LIBOS_TARGET})
endfunction(add_redis)
