Add release option to cmake in bindings
@@ -6,6 +6,7 @@ include(FetchContent)
option(NO_STD "Enable no_std build, without iota_client" OFF)
option(SYNC_CLIENT "Enable sync transport via iota_client" ON)
option(STATIC "Build static library" OFF)
+option(RELEASE "Build release library (defaults to debug)" OFF)
set(cargo_features "")
if(${NO_STD})
@@ -51,7 +52,16 @@ else(${STATIC})
set(SHARED_OBJECT_FILE libiota_streams_c.so)
endif (APPLE)
set(FAKE_TARGET fakeTarget)
- add_custom_target(fakeTarget cargo build --target-dir ../../target --no-default-features --features "${cargo_features}" COMMAND cp ../../target/debug/${SHARED_OBJECT_FILE} ${CMAKE_CURRENT_SOURCE_DIR})
+ if(${RELEASE})
+ message("Building Release")
+ set(BUILD_FLAG --release)
+ set(BUILD_LOCATION release)
+ else(${RELEASE})
+ message("Building Debug")
+ set(BUILD_FLAG --debug)
+ set(BUILD_LOCATION debug)
+ endif(${RELEASE})
+ add_custom_target(fakeTarget cargo build ${BUILD_FLAG} --target-dir ../../target --no-default-features --features "${cargo_features}" COMMAND cp ../../target/${BUILD_LOCATION}/${SHARED_OBJECT_FILE} ${CMAKE_CURRENT_SOURCE_DIR})
add_dependencies(${PROJECT_NAME} ${FAKE_TARGET})
target_link_libraries(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/${SHARED_OBJECT_FILE})
@@ -63,3 +73,4 @@ endif()
unset(NO_STD CACHE)
unset(SYNC_CLIENT CACHE)
unset(STATIC CACHE)
+unset(RELEASE CACHE)
