diff --git a/CMakeLists.txt b/CMakeLists.txt index 048a05537..a3891058a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,7 +102,6 @@ add_custom_command( OUTPUT ${rust_target_dir}/${rust_profile}/libfish.rlib COMMAND ${CMAKE_COMMAND} -E env ${VARS_FOR_CARGO} - $<$:RUSTFLAGS=-g> ${Rust_CARGO} ARGS build --lib $<$:--release> @@ -122,7 +121,6 @@ function(FISH_LINK_DEPS_AND_SIGN target) OUTPUT ${rust_target_dir}/${rust_profile}/${target} COMMAND ${CMAKE_COMMAND} -E env ${VARS_FOR_CARGO} - $<$:RUSTFLAGS=-g> ${Rust_CARGO} ARGS build --bin ${target} $<$:--release> --target ${Rust_CARGO_TARGET} diff --git a/cmake/Rust.cmake b/cmake/Rust.cmake index 2f30c3782..fe97ec68e 100644 --- a/cmake/Rust.cmake +++ b/cmake/Rust.cmake @@ -19,6 +19,8 @@ else() endif() set(rust_profile $,debug,release>) +set(rust_debugflags "$<$:-g>") + # Temporary hack to propogate CMake flags/options to build.rs. We need to get CMake to evaluate the # truthiness of the strings if they are set. @@ -56,4 +58,5 @@ set(VARS_FOR_CARGO "CARGO_TARGET_DIR=${FISH_RUST_BUILD_DIR}" "CARGO_BUILD_RUSTC=${RUSTC_EXECUTABLE}" "${FISH_PCRE2_BUILDFLAG}" + "RUSTFLAGS=$ENV{RUSTFLAGS} ${rust_debugflags}" )