From 35baa88334444c3f6778aa80b31ba3a65330ce69 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Thu, 28 Sep 2023 17:30:40 +0200 Subject: [PATCH] cmake: Canonicalize binary dir This would otherwise fail to set $fish_function_path to share/functions etc if run through a symlink. --- cmake/Rust.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/Rust.cmake b/cmake/Rust.cmake index c87cd1917..5d24905f9 100644 --- a/cmake/Rust.cmake +++ b/cmake/Rust.cmake @@ -59,9 +59,12 @@ if(DEFINED WITH_GETTEXT AND NOT "${WITH_GETTEXT}") set(CMAKE_WITH_GETTEXT "0") endif() +# CMAKE_BINARY_DIR can include symlinks, since we want to compare this to the dir fish is executed in we need to canonicalize it. +file(REAL_PATH "${CMAKE_BINARY_DIR}" fish_binary_dir) + # Tell Cargo where our build directory is so it can find config.h. corrosion_set_env_vars(${fish_rust_target} - "FISH_BUILD_DIR=${CMAKE_BINARY_DIR}" + "FISH_BUILD_DIR=${fish_binary_dir}" "FISH_AUTOCXX_GEN_DIR=${fish_autocxx_gen_dir}" "FISH_RUST_TARGET_DIR=${rust_target_dir}" "PREFIX=${CMAKE_INSTALL_PREFIX}"