summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-04-04 13:24:57 (GMT)
committerBrad King <brad.king@kitware.com>2023-04-04 13:24:57 (GMT)
commitf8deb841205a6449d8b28c356709c6762595c135 (patch)
tree78684e51ee2251d91100f3d8188d035b1e2a20e8
parentb5e972f6299a0b681b25c959c35ac64baec6c17e (diff)
parent52dbfefe0d5b592933c7b712086a9000155cc546 (diff)
downloadCMake-f8deb841205a6449d8b28c356709c6762595c135.zip
CMake-f8deb841205a6449d8b28c356709c6762595c135.tar.gz
CMake-f8deb841205a6449d8b28c356709c6762595c135.tar.bz2
Merge topic 'swift-xcode-14.3' into release-3.26
52dbfefe0d Xcode: Fix detection of Swift compiler location for Xcode 14.3 Merge-request: !8388
-rw-r--r--Modules/CMakeDetermineSwiftCompiler.cmake12
1 files changed, 8 insertions, 4 deletions
diff --git a/Modules/CMakeDetermineSwiftCompiler.cmake b/Modules/CMakeDetermineSwiftCompiler.cmake
index f0a63a8..7239424 100644
--- a/Modules/CMakeDetermineSwiftCompiler.cmake
+++ b/Modules/CMakeDetermineSwiftCompiler.cmake
@@ -15,7 +15,14 @@ if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
message(FATAL_ERROR "Swift language not supported by Xcode ${XCODE_VERSION}")
endif()
set(CMAKE_Swift_COMPILER_XCODE_TYPE sourcecode.swift)
- _cmake_find_compiler_path(Swift)
+ execute_process(COMMAND xcrun --find swiftc
+ OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE _xcrun_err RESULT_VARIABLE _xcrun_result)
+ if(_xcrun_result EQUAL 0 AND EXISTS "${_xcrun_out}")
+ set(CMAKE_Swift_COMPILER "${_xcrun_out}")
+ else()
+ _cmake_find_compiler_path(Swift)
+ endif()
elseif("${CMAKE_GENERATOR}" MATCHES "^Ninja")
if(CMAKE_Swift_COMPILER)
_cmake_find_compiler_path(Swift)
@@ -52,9 +59,6 @@ if(NOT CMAKE_Swift_COMPILER_ID_RUN)
if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
list(APPEND CMAKE_Swift_COMPILER_ID_MATCH_VENDORS Apple)
set(CMAKE_Swift_COMPILER_ID_MATCH_VENDOR_REGEX_Apple "com.apple.xcode.tools.swift.compiler")
-
- set(CMAKE_Swift_COMPILER_ID_TOOL_MATCH_REGEX "\nCompileSwift[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]* -c[^\r\n]*CompilerIdSwift/CompilerId/main.swift")
- set(CMAKE_Swift_COMPILER_ID_TOOL_MATCH_INDEX 2)
endif()
# Try to identify the compiler.