From c90862cd3d82f90b0d1b1a1673779e600d3630fa Mon Sep 17 00:00:00 2001 From: Peter Ammon Date: Sun, 7 Jul 2024 11:30:28 -0700 Subject: [PATCH] Remove legacy Mac.cmake --- CMakeLists.txt | 16 ++++++---------- cmake/Mac.cmake | 42 ------------------------------------------ 2 files changed, 6 insertions(+), 52 deletions(-) delete mode 100644 cmake/Mac.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ada4cc53..0e470c83b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,8 +3,6 @@ cmake_minimum_required(VERSION 3.19) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") -include(cmake/Mac.cmake) - project(fish LANGUAGES C) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -49,9 +47,8 @@ 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}") - -# Define a function to link dependencies. -function(FISH_LINK_DEPS_AND_SIGN target) +# Define a function to build and link dependencies. +function(CREATE_TARGET target) add_custom_target( ${target} ALL COMMAND @@ -69,17 +66,16 @@ function(FISH_LINK_DEPS_AND_SIGN target) WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" USES_TERMINAL ) - codesign_on_mac(${target}) -endfunction(FISH_LINK_DEPS_AND_SIGN) +endfunction(CREATE_TARGET) # Define fish. -fish_link_deps_and_sign(fish) +create_target(fish) # Define fish_indent. -fish_link_deps_and_sign(fish_indent) +create_target(fish_indent) # Define fish_key_reader. -fish_link_deps_and_sign(fish_key_reader) +create_target(fish_key_reader) # Set up the docs. include(cmake/Docs.cmake) diff --git a/cmake/Mac.cmake b/cmake/Mac.cmake deleted file mode 100644 index fde2255ea..000000000 --- a/cmake/Mac.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# Code signing ID on Mac. -# If this is falsey, codesigning is disabled. -# '-' is ad-hoc codesign. -set(MAC_CODESIGN_ID "" CACHE STRING "Mac code-signing identity") - -# Whether to inject the "get-task-allow" entitlement, which permits debugging -# on the Mac. -set(MAC_INJECT_GET_TASK_ALLOW ON CACHE BOOL "Inject get-task-allow on Mac") - -# When building a Mac build, it is common for fish to link against a -# pcre2 built for the host platform (e.g. macOS 10.15) while fish wants -# to link for macOS 10.9. This warning would be of interest for releases, -# but is just noise for daily development. Unfortunately it has no flag -# of its own, so suppress all linker warnings in debug builds. -set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -w") - -function(CODESIGN_ON_MAC target) - if((APPLE) AND (MAC_CODESIGN_ID)) - execute_process(COMMAND sw_vers "-productVersion" OUTPUT_VARIABLE OSX_VERSION) - if(MAC_INJECT_GET_TASK_ALLOW) - set(ENTITLEMENTS "--entitlements" "${CMAKE_SOURCE_DIR}/osx/fish_debug.entitlements") - else() - set(ENTITLEMENTS "") - endif(MAC_INJECT_GET_TASK_ALLOW) - if(OSX_VERSION VERSION_LESS "10.13.6") - # `-options runtime` is only available in OS X from 10.13.6 and up - add_custom_command( - TARGET ${target} - POST_BUILD - COMMAND codesign --force --deep ${ENTITLEMENTS} --sign "${MAC_CODESIGN_ID}" $ - VERBATIM - ) - else() - add_custom_command( - TARGET ${target} - POST_BUILD - COMMAND codesign --force --deep --options runtime ${ENTITLEMENTS} --sign "${MAC_CODESIGN_ID}" $ - VERBATIM - ) - endif() - endif() -endfunction(CODESIGN_ON_MAC target)