mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-19 14:51:13 -03:00
Rename FISH_BUILD_DIR variable, to assert that CMake is used
It's always the CMake output directory, so call it FISH_CMAKE_BINARY_DIR. It's possible to set it via some other build system but if such builds exist, they are likely subtly broken, or at least with the following commit which adds the assumption that "share/__fish_build_paths.fish.in" exists in this directory. We could even call it CMAKE_BINARY_DIR but let's namespace it to make our use more obvious. Also, stop using the $CMAKE environment variable, it's not in our namespace.
This commit is contained in:
1
build.rs
1
build.rs
@@ -81,6 +81,7 @@ fn detect_cfgs(target: &mut Target) {
|
||||
("", &(|_: &Target| false) as &dyn Fn(&Target) -> bool),
|
||||
("apple", &detect_apple),
|
||||
("bsd", &detect_bsd),
|
||||
("using_cmake", &|_| option_env!("FISH_CMAKE_BINARY_DIR").is_some()),
|
||||
("cygwin", &detect_cygwin),
|
||||
("small_main_stack", &has_small_stack),
|
||||
// See if libc supports the thread-safe localeconv_l(3) alternative to localeconv(3).
|
||||
|
||||
@@ -31,10 +31,8 @@ list(JOIN FISH_CARGO_FEATURES_LIST , FISH_CARGO_FEATURES)
|
||||
|
||||
# Tell Cargo where our build directory is so it can find Cargo.toml.
|
||||
set(VARS_FOR_CARGO
|
||||
"FISH_BUILD_DIR=${CMAKE_BINARY_DIR}"
|
||||
"FISH_CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}"
|
||||
"PREFIX=${CMAKE_INSTALL_PREFIX}"
|
||||
# Cheesy so we can tell cmake was used to build
|
||||
"CMAKE=1"
|
||||
"DOCDIR=${CMAKE_INSTALL_FULL_DOCDIR}"
|
||||
"DATADIR=${CMAKE_INSTALL_FULL_DATADIR}"
|
||||
"SYSCONFDIR=${CMAKE_INSTALL_FULL_SYSCONFDIR}"
|
||||
|
||||
@@ -29,8 +29,7 @@ fn cargo_target_dir() -> Cow<'static, Path> {
|
||||
}
|
||||
|
||||
pub fn fish_build_dir() -> Cow<'static, Path> {
|
||||
// This is set if using CMake.
|
||||
option_env!("FISH_BUILD_DIR")
|
||||
option_env!("FISH_CMAKE_BINARY_DIR")
|
||||
.map(|d| Cow::Borrowed(Path::new(d)))
|
||||
.unwrap_or(cargo_target_dir())
|
||||
}
|
||||
|
||||
@@ -579,10 +579,7 @@ pub fn status(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr]) -> B
|
||||
let host = bytes2wcstring(env!("BUILD_HOST_TRIPLE").as_bytes());
|
||||
let profile = bytes2wcstring(env!("BUILD_PROFILE").as_bytes());
|
||||
streams.out.append(L!("Build system: "));
|
||||
let buildsystem = match option_env!("CMAKE") {
|
||||
Some("1") => "CMake",
|
||||
_ => "Cargo",
|
||||
};
|
||||
let buildsystem = if cfg!(using_cmake) { "CMake" } else { "Cargo" };
|
||||
streams.out.appendln(bytes2wcstring(buildsystem.as_bytes()));
|
||||
streams.out.append(L!("Version: "));
|
||||
streams.out.appendln(version);
|
||||
|
||||
Reference in New Issue
Block a user