diff --git a/cmake/Corrosion.cmake b/cmake/Corrosion.cmake index abbfd254..1af19949 100644 --- a/cmake/Corrosion.cmake +++ b/cmake/Corrosion.cmake @@ -252,10 +252,7 @@ function(_add_cargo_build) set(no_default_libraries_arg --no-default-libraries) endif() - set(rustflags_target_property "$>") - # `rustflags_target_property` may contain multiple arguments and double quotes, so we _should_ single quote it to - # preserve any double quotes and keep it as one argument value. However single quotes don't work on windows, so we - # can only add double quotes here. Any double quotes _in_ the rustflags must be escaped like `\\\"`. + set(global_rustflags_target_property "$>") set(features_target_property "$>") set(features_genex "$<$:--features=$>>") @@ -358,8 +355,8 @@ function(_add_cargo_build) corrosion_add_target_rustflags("${target_name}" "-Cdefault-linker-libraries=yes") endif() - set(joined_rustflags "$") - set(rustflags_genex "$<$:RUSTFLAGS=${joined_rustflags}>") + set(global_joined_rustflags "$") + set(global_rustflags_genex "$<$:RUSTFLAGS=${global_joined_rustflags}>") # Used to set a linker for a specific target-triple. set(cargo_target_linker_var "CARGO_TARGET_${_CORROSION_RUST_CARGO_TARGET_UPPER}_LINKER") @@ -397,7 +394,7 @@ function(_add_cargo_build) COMMAND ${CMAKE_COMMAND} -E env "${build_env_variable_genex}" - "${rustflags_genex}" + "${global_rustflags_genex}" "${cargo_target_linker}" "${corrosion_cc_rs_flags}" "${cargo_library_path}"