[compiler-rt] f28c833 - Fix issue where MACOSX_VERSION_MIN_FLAG was not set on subsequent runs of CMake in compiler-rt (#87580)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 8 16:34:33 PDT 2024
Author: Chris Apple
Date: 2024-04-08T16:34:30-07:00
New Revision: f28c8339c12917b11c99432de6609e7d46e17e2b
URL: https://github.com/llvm/llvm-project/commit/f28c8339c12917b11c99432de6609e7d46e17e2b
DIFF: https://github.com/llvm/llvm-project/commit/f28c8339c12917b11c99432de6609e7d46e17e2b.diff
LOG: Fix issue where MACOSX_VERSION_MIN_FLAG was not set on subsequent runs of CMake in compiler-rt (#87580)
As discussed here:
https://github.com/llvm/llvm-project/pull/74394#issuecomment-2035264683
An unintentional change of behavior was introduced in #74394
This code introduced in #74394 :
The first time through
* SANITIZER_MIN_OSX_VERSION is not set
* parse -mmacosx-version-min and set MACOSX_VERSION_MIN_FLAG
* Set and cache SANITIZER_MIN_OSX_VERSION
Subsequent times through:
* SANITIZER_MIN_OSX_VERSION is cached
* (BUG!!) you don't parse -mmacosx-version-min, and don't set
MACOSX_VERSION_MIN_FLAG
MACOSX_VERSION_MIN_FLAG is used later in the file on this line:
https://github.com/llvm/llvm-project/blob/63c925ca808f216f805b76873743450456e350f2/compiler-rt/cmake/config-ix.cmake#L517
Hoisting this assignment outside the if block returns us to the previous
behavior before this commit, while maintaining the flexibility
introduced with the cache variable
Added:
Modified:
compiler-rt/cmake/config-ix.cmake
Removed:
################################################################################
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index 46a6fdf8728ff8..b281ac64f5d5c7 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -463,9 +463,11 @@ if(APPLE)
set(DEFAULT_SANITIZER_MIN_OSX_VERSION 10.13)
set(DARWIN_osx_MIN_VER_FLAG "-mmacosx-version-min")
+
+ string(REGEX MATCH "${DARWIN_osx_MIN_VER_FLAG}=([.0-9]+)"
+ MACOSX_VERSION_MIN_FLAG "${CMAKE_CXX_FLAGS}")
+
if(NOT SANITIZER_MIN_OSX_VERSION)
- string(REGEX MATCH "${DARWIN_osx_MIN_VER_FLAG}=([.0-9]+)"
- MACOSX_VERSION_MIN_FLAG "${CMAKE_CXX_FLAGS}")
if(MACOSX_VERSION_MIN_FLAG)
set(MIN_OSX_VERSION "${CMAKE_MATCH_1}")
elseif(CMAKE_OSX_DEPLOYMENT_TARGET)
More information about the llvm-commits
mailing list