diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e95fe824..ca69fe89f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,9 +169,13 @@ set_genexpr_condition(libs DEBUG $ "${libsd}" "${libsr}") # # Build rust sources # -set_genexpr_condition(cargo_release_flag DEBUG $ "" "--release") -set(cargo_flags ${ZENOHC_CARGO_FLAGS} ${cargo_release_flag}) -set(cargo_flags ${cargo_flags} --manifest-path=${cargo_toml_dir}/Cargo.toml) + +# Combine "--release" and "--manifest-path" options under DEBUG condition to avoid passing empty parameter to cargo command line in `add_custom_command`, causing build failure +# This empty item ($;,--release>) can't be filtered out by `list(FILTER ...)` because it becomes empty only on +# build stage when generator expressions are evaluated. +set_genexpr_condition(cargo_flags DEBUG $ + "--manifest-path=${cargo_toml_dir}/Cargo.toml" + "--release;--manifest-path=${cargo_toml_dir}/Cargo.toml") if(ZENOHC_BUILD_WITH_LOGGER_AUTOINIT) set(cargo_flags ${cargo_flags} --features=logger-autoinit)