diff --git a/cmake/Rust.cmake b/cmake/Rust.cmake index b3fcf23e9..3f29464aa 100644 --- a/cmake/Rust.cmake +++ b/cmake/Rust.cmake @@ -54,7 +54,7 @@ file(REAL_PATH "${CMAKE_BINARY_DIR}" fish_binary_dir) string(JOIN "," CURSES_LIBRARY_LIST ${CURSES_LIBRARY} ${CURSES_EXTRA_LIBRARY}) # Tell Cargo where our build directory is so it can find config.h. -corrosion_set_env_vars(${fish_rust_target} +set(VARS_FOR_CARGO "FISH_BUILD_DIR=${fish_binary_dir}" "PREFIX=${CMAKE_INSTALL_PREFIX}" # Temporary hack to propogate CMake flags/options to build.rs. @@ -66,3 +66,5 @@ corrosion_set_env_vars(${fish_rust_target} "LOCALEDIR=${CMAKE_INSTALL_FULL_LOCALEDIR}" "CURSES_LIBRARY_LIST=${CURSES_LIBRARY_LIST}" ) + +corrosion_set_env_vars(${fish_rust_target} ${VARS_FOR_CARGO}) diff --git a/cmake/Tests.cmake b/cmake/Tests.cmake index a416ce3b3..885cf367d 100644 --- a/cmake/Tests.cmake +++ b/cmake/Tests.cmake @@ -163,7 +163,7 @@ endif() if(NOT DEFINED ASAN) add_test( NAME "cargo-test" - COMMAND cargo test ${CARGO_FLAGS} --package fish-rust --target-dir target ${cargo_target_opt} + COMMAND env ${VARS_FOR_CARGO} cargo test ${CARGO_FLAGS} --package fish-rust --target-dir target ${cargo_target_opt} WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" ) set_tests_properties("cargo-test" PROPERTIES SKIP_RETURN_CODE ${SKIP_RETURN_CODE}) @@ -172,7 +172,7 @@ endif() add_test( NAME "cargo-test-widestring" - COMMAND cargo test ${CARGO_FLAGS} --package widestring-suffix --target-dir target ${cargo_target_opt} + COMMAND env ${VARS_FOR_CARGO} cargo test ${CARGO_FLAGS} --package widestring-suffix --target-dir target ${cargo_target_opt} WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" ) add_test_target("cargo-test-widestring")