From 5bfc02f498379c1610134cca98c1ba4d38b18a75 Mon Sep 17 00:00:00 2001 From: Alexey Sakovets Date: Sat, 9 Nov 2024 20:54:41 +0300 Subject: [PATCH] Fix cmake build on macOS with Xcode generator --- CMakeLists.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c6af4ea..2af4c00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,11 @@ cmake_minimum_required(VERSION 3.13) # add_link_options requires 3.13 https://cmake.org/cmake/help/v3.13/command/add_link_options.html +# CMake docs specifically say that the deployment target must be set +# before first call to project() and it must be a cache variable: +# https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_DEPLOYMENT_TARGET.html +set(CMAKE_OSX_DEPLOYMENT_TARGET 10.7 CACHE STRING "") + project(qgrep) include(GNUInstallDirs) @@ -32,7 +37,7 @@ if (WIN32) message(WARNING "SIMD acceleration is disabled on ${CMAKE_SYSTEM_PROCESSOR}") endif() else() - add_compile_options(-Wall -Werror) + add_compile_options(-Wall -Werror -Wno-error=shorten-64-to-32) if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)") add_compile_options(-msse2 -DUSE_SSE2) @@ -43,11 +48,7 @@ else() endif() if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - add_compile_options( - -mmacosx-version-min=10.7 - ) add_link_options( - -mmacosx-version-min=10.7 "SHELL:-framework CoreFoundation" "SHELL:-framework CoreServices" )