From cb51b236f38083c52d1eb79570e5b093fa1f772c Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Wed, 10 Jan 2024 17:41:34 +0100 Subject: [PATCH] cmake: Include GNUInstallDirs earlier for BINDIR etc to take effect GNUInstallDirs is what defines CMAKE_INSTALL_FULL_BINDIR and such, so the setting in Rust.cmake didn't work. This also makes build.rs error out if any of these aren't defined --- CMakeLists.txt | 16 ++++------------ cmake/Install.cmake | 9 --------- fish-rust/build.rs | 3 +++ 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9dec5167d..4e91889e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,10 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}") endif() +# Set up standard directories. +include(GNUInstallDirs) +add_definitions(-D_UNICODE=1) + include(cmake/ConfigureChecks.cmake) include(cmake/gettext.cmake) @@ -110,18 +114,6 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) # Pull in our src directory for headers searches, but only quoted ones. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -iquote ${CMAKE_CURRENT_SOURCE_DIR}/src") - - -# Set up standard directories. -include(GNUInstallDirs) -add_definitions(-D_UNICODE=1 - -DLOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}" - -DPREFIX=L"${CMAKE_INSTALL_PREFIX}" - -DDATADIR=L"${CMAKE_INSTALL_FULL_DATADIR}" - -DSYSCONFDIR=L"${CMAKE_INSTALL_FULL_SYSCONFDIR}" - -DBINDIR=L"${CMAKE_INSTALL_FULL_BINDIR}" - -DDOCDIR=L"${CMAKE_INSTALL_FULL_DOCDIR}") - # Set up the machinery around FISH-BUILD-VERSION-FILE # This defines the FBVF variable. include(Version) diff --git a/cmake/Install.cmake b/cmake/Install.cmake index 0947b802b..7b1a2b188 100644 --- a/cmake/Install.cmake +++ b/cmake/Install.cmake @@ -41,15 +41,6 @@ set(extra_confdir CACHE STRING "Path for extra configuration") -corrosion_set_env_vars(${fish_rust_target} - "PREFIX=${prefix}" - # Temporary hack to propogate CMake flags/options to build.rs. - "CMAKE_WITH_GETTEXT=${CMAKE_WITH_GETTEXT}" - "DOCDIR=${CMAKE_INSTALL_FULL_DOCDIR}" - "DATADIR=${CMAKE_INSTALL_FULL_DATADIR}" - "SYSCONFDIR=${CMAKE_INSTALL_FULL_SYSCONFDIR}" - "BINDIR=${CMAKE_INSTALL_FULL_BINDIR}" -) # These are the man pages that go in system manpath; all manpages go in the fish-specific manpath. set(MANUALS ${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish.1 ${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish_indent.1 diff --git a/fish-rust/build.rs b/fish-rust/build.rs index da8578b0c..337823bd5 100644 --- a/fish-rust/build.rs +++ b/fish-rust/build.rs @@ -8,6 +8,9 @@ fn main() { for key in ["DOCDIR", "DATADIR", "SYSCONFDIR", "BINDIR", "LOCALEDIR"] { if let Ok(val) = env::var(key) { // Forward some CMake config + if val.is_empty() { + panic!("{} is empty!", key); + } println!("cargo:rustc-env={key}={val}"); } }