mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-09 00:31:14 -03:00
This appends "-g" to RUSTFLAGS if the cmake build type is debug or RelWithDebInfo. However, these are already mapped to cargo profiles that enable these things, see https://doc.rust-lang.org/cargo/reference/profiles.html: > The debug setting controls the -C debuginfo flag which controls the amount of debug information included in the compiled binary. (`rustc -g` is equivalent to `debuginfo=2`) By setting $RUSTFLAGS in cmake, we bake it into the generated makefile (/ninja thing), which is surprising. See #12165
30 lines
965 B
CMake
30 lines
965 B
CMake
include(FindRust)
|
|
find_package(Rust REQUIRED)
|
|
|
|
set(FISH_RUST_BUILD_DIR "${CMAKE_BINARY_DIR}/cargo/build")
|
|
|
|
if(DEFINED ASAN)
|
|
list(APPEND CARGO_FLAGS "-Z" "build-std")
|
|
list(APPEND FISH_CARGO_FEATURES_LIST "asan")
|
|
endif()
|
|
if(DEFINED TSAN)
|
|
list(APPEND CARGO_FLAGS "-Z" "build-std")
|
|
list(APPEND FISH_CARGO_FEATURES_LIST "tsan")
|
|
endif()
|
|
|
|
if (Rust_CARGO_TARGET)
|
|
set(rust_target_dir "${FISH_RUST_BUILD_DIR}/${Rust_CARGO_TARGET}")
|
|
else()
|
|
set(rust_target_dir "${FISH_RUST_BUILD_DIR}/${Rust_CARGO_HOST_TARGET}")
|
|
endif()
|
|
|
|
set(rust_profile $<IF:$<CONFIG:Debug>,debug,$<IF:$<CONFIG:RelWithDebInfo>,release-with-debug,release>>)
|
|
|
|
option(WITH_GETTEXT "Build with gettext localization support. Requires `msgfmt` to work." ON)
|
|
# Enable gettext feature unless explicitly disabled.
|
|
if(NOT DEFINED WITH_GETTEXT OR "${WITH_GETTEXT}")
|
|
list(APPEND FISH_CARGO_FEATURES_LIST "localize-messages")
|
|
endif()
|
|
|
|
list(JOIN FISH_CARGO_FEATURES_LIST , FISH_CARGO_FEATURES)
|