From 721a3607071f68012d9aa812c0c63bca1db7cec7 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Sun, 3 Mar 2024 20:21:16 +0100 Subject: [PATCH] cmake: Remove a bunch of unnecessary code We are no longer C++, we no longer support xcode Note: This will remove a warning "DO NOT EDIT" comment from __fish_build_paths.fish, but that's unnecessary. The file is typically in /usr or another package-manager-owned location, so people don't typically edit it. And if it did we don't actually *care*, it'll work fine. --- CMakeLists.txt | 50 --------------------------------------------- cmake/Install.cmake | 12 ----------- cmake/gettext.cmake | 23 --------------------- 3 files changed, 85 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 17d4d24fe..342e6fb55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,3 @@ -# CMake 3.15 is required to support Corrosion # CMake 3.19 is needed for file(REAL_PATH) cmake_minimum_required(VERSION 3.19) @@ -33,43 +32,6 @@ include(cmake/PCRE2.cmake) include(cmake/Rust.cmake) -# Error out when linking statically, it doesn't work. -if (CMAKE_EXE_LINKER_FLAGS MATCHES ".*-static.*") - message(FATAL_ERROR "Fish does not support static linking") -endif() - -# Force colored warnings in Ninja's output, if the compiler has -fdiagnostics-color support. -# Rationale in https://github.com/ninja-build/ninja/issues/814 -if (CMAKE_GENERATOR STREQUAL "Ninja" AND - ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) OR - (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5) OR - (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0))) - add_compile_options(-fdiagnostics-color=always) -endif() - -# Enable a whole bunch of warnings, but turn off: -# - comment because we use a bunch of those, and they're not really all that harmful. -# - address, because that occurs for our mkostemp check (weak-linking requires us to compare `&mkostemp == nullptr`). -add_compile_options(-Wall -Wextra -Wno-comment -Wno-address) - -if ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")) - add_compile_options(-Wunused-template -Wunused-local-typedef -Wunused-macros) -endif() - -# Disable exception handling. -add_compile_options(-fno-exceptions) - -# Hide the CMake Rules directories in Xcode projects. -source_group("CMake Rules" REGULAR_EXPRESSION "^$") - -# Put source and header files at top level under targets. -source_group("Source Files" REGULAR_EXPRESSION ".*\\.cpp") -source_group("Header Files" REGULAR_EXPRESSION ".*\\.h") -source_group("Builtins" "builtins/") - -# Support folders. -set_property(GLOBAL PROPERTY USE_FOLDERS ON) - # Work around issue where archive-built libs go in the wrong place. set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) @@ -89,9 +51,6 @@ get_filename_component(REAL_CMAKE_SOURCE_DIR "${CMAKE_SOURCE_DIR}" REALPATH) add_definitions(-DCMAKE_BINARY_DIR="${REAL_CMAKE_BINARY_DIR}") add_definitions(-DCMAKE_SOURCE_DIR="${REAL_CMAKE_SOURCE_DIR}") -# Enable thread-safe errno on Solaris (#5611) -add_definitions(-D_REENTRANT) - # cargo needs to be rerun when the sources change. # This is imperfect, but the ninja generator really wants to # not run cargo, so we need to tell it *something* @@ -150,14 +109,5 @@ include(cmake/Install.cmake) # Mac app. include(cmake/MacApp.cmake) -# ThreadSanitizer likes to muck with signal handlers, which interferes -# with fish_test_helper printing the ignored signal mask. -# Ensure fish_test_helper does not use TSan. -# Note the environment var is CXXFLAGS, but the CMake var is CMAKE_CXX_FLAGS. -if (CMAKE_CXX_FLAGS MATCHES ".*-fsanitize=thread.*") - target_compile_options(fish_test_helper PRIVATE "-fno-sanitize=all") - target_link_libraries(fish_test_helper "-fno-sanitize=all") -endif() - include(FeatureSummary) feature_summary(WHAT ALL) diff --git a/cmake/Install.cmake b/cmake/Install.cmake index bf32d749a..8e67fb8cf 100644 --- a/cmake/Install.cmake +++ b/cmake/Install.cmake @@ -1,10 +1,3 @@ -# -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(CMAKE_INSTALL_MESSAGE NEVER) set(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fish ${CMAKE_CURRENT_BINARY_DIR}/fish_indent ${CMAKE_CURRENT_BINARY_DIR}/fish_key_reader) @@ -19,11 +12,6 @@ file(RELATIVE_PATH rel_datadir ${CMAKE_INSTALL_PREFIX} ${datadir}) set(docdir ${CMAKE_INSTALL_DOCDIR}) -# Comment at the top of some .in files -set(configure_input -"This file was generated from a corresponding .in file.\ - DO NOT MANUALLY EDIT THIS FILE!") - set(rel_completionsdir "fish/vendor_completions.d") set(rel_functionsdir "fish/vendor_functions.d") set(rel_confdir "fish/vendor_conf.d") diff --git a/cmake/gettext.cmake b/cmake/gettext.cmake index d180afef1..9e6986af6 100644 --- a/cmake/gettext.cmake +++ b/cmake/gettext.cmake @@ -4,21 +4,7 @@ include(FeatureSummary) option(WITH_GETTEXT "translate messages if gettext is available" ON) if(WITH_GETTEXT) - if(APPLE) - # Fix for https://github.com/fish-shell/fish-shell/issues/5244 - # via https://gitlab.kitware.com/cmake/cmake/-/issues/18921 - set(CMAKE_FIND_FRAMEWORK_OLD ${CMAKE_FIND_FRAMEWORK}) - set(CMAKE_FIND_FRAMEWORK NEVER) - endif() - find_package(Intl QUIET) find_package(Gettext) - if(GETTEXT_FOUND) - include_directories(${Intl_INCLUDE_DIR}) - endif() - if(APPLE) - set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_OLD}) - unset(CMAKE_FIND_FRAMEWORK_OLD) - endif() endif() add_feature_info(gettext GETTEXT_FOUND "translate messages with gettext") @@ -34,12 +20,3 @@ if(GETTEXT_FOUND) endforeach() set(CMAKE_FOLDER) endif() - -include(CMakePushCheckState) -cmake_push_check_state() -set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${Intl_INCLUDE_DIR}) -set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${Intl_LIBRARIES}) -# libintl.h can be compiled into the stdlib on some GLibC systems -if(Intl_FOUND AND Intl_LIBRARIES) - set(LIBINTL_INCLUDE "#include ") -endif()