Skip to content

Commit f28c833

Browse files
authored
Fix issue where MACOSX_VERSION_MIN_FLAG was not set on subsequent runs of CMake in compiler-rt (#87580)
As discussed here: #74394 (comment) 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
1 parent 118a5d8 commit f28c833

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler-rt/cmake/config-ix.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,11 @@ if(APPLE)
463463

464464
set(DEFAULT_SANITIZER_MIN_OSX_VERSION 10.13)
465465
set(DARWIN_osx_MIN_VER_FLAG "-mmacosx-version-min")
466+
467+
string(REGEX MATCH "${DARWIN_osx_MIN_VER_FLAG}=([.0-9]+)"
468+
MACOSX_VERSION_MIN_FLAG "${CMAKE_CXX_FLAGS}")
469+
466470
if(NOT SANITIZER_MIN_OSX_VERSION)
467-
string(REGEX MATCH "${DARWIN_osx_MIN_VER_FLAG}=([.0-9]+)"
468-
MACOSX_VERSION_MIN_FLAG "${CMAKE_CXX_FLAGS}")
469471
if(MACOSX_VERSION_MIN_FLAG)
470472
set(MIN_OSX_VERSION "${CMAKE_MATCH_1}")
471473
elseif(CMAKE_OSX_DEPLOYMENT_TARGET)

0 commit comments

Comments
 (0)