mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 07:02:05 +08:00
Move fish build dir canonicalization into build.rs, to lower CMake version
This commit is contained in:
parent
f71233ae02
commit
f033bccd3c
|
@ -1,5 +1,4 @@
|
|||
# CMake 3.19 is needed for file(REAL_PATH)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||
|
||||
|
|
2
build.rs
2
build.rs
|
@ -15,6 +15,8 @@ fn main() {
|
|||
// OUT_DIR is set by Cargo when the build script is running (not compiling)
|
||||
let default_build_dir = env::var("OUT_DIR").unwrap();
|
||||
let build_dir = option_env!("FISH_BUILD_DIR").unwrap_or(&default_build_dir);
|
||||
let build_dir = std::fs::canonicalize(build_dir).unwrap();
|
||||
let build_dir = build_dir.to_str().unwrap();
|
||||
rsconf::set_env_value("FISH_BUILD_DIR", build_dir);
|
||||
// We need to canonicalize (i.e. realpath) the manifest dir because we want to be able to
|
||||
// compare it directly as a string at runtime.
|
||||
|
|
|
@ -29,9 +29,6 @@ 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)
|
||||
|
||||
if(FISH_CRATE_FEATURES)
|
||||
set(FEATURES_ARG ${FISH_CRATE_FEATURES})
|
||||
list(PREPEND FEATURES_ARG "--features")
|
||||
|
@ -44,7 +41,7 @@ get_property(
|
|||
|
||||
# Tell Cargo where our build directory is so it can find Cargo.toml.
|
||||
set(VARS_FOR_CARGO
|
||||
"FISH_BUILD_DIR=${fish_binary_dir}"
|
||||
"FISH_BUILD_DIR=${CMAKE_BINARY_DIR}"
|
||||
"PREFIX=${CMAKE_INSTALL_PREFIX}"
|
||||
# Temporary hack to propogate CMake flags/options to build.rs.
|
||||
"CMAKE_WITH_GETTEXT=${CMAKE_WITH_GETTEXT}"
|
||||
|
|
Loading…
Reference in New Issue
Block a user