Commit 07235822 authored by Brad King's avatar Brad King

Swift: Detect compiler version

parent 086c51dc
......@@ -84,6 +84,30 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
endif()
endif()
# For Swift we need to explicitly query the version.
if(lang STREQUAL "Swift"
AND CMAKE_${lang}_COMPILER
AND NOT CMAKE_${lang}_COMPILER_VERSION)
execute_process(
COMMAND "${CMAKE_${lang}_COMPILER}"
-version
OUTPUT_VARIABLE output ERROR_VARIABLE output
RESULT_VARIABLE result
TIMEOUT 10
)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Running the ${lang} compiler: \"${CMAKE_${lang}_COMPILER}\" -version\n"
"${output}\n"
)
if(output MATCHES [[Swift version ([0-9]+\.[0-9]+(\.[0-9]+)?)]])
set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_MATCH_1}")
if(NOT CMAKE_${lang}_COMPILER_ID)
set(CMAKE_Swift_COMPILER_ID "Apple")
endif()
endif()
endif()
if (COMPILER_QNXNTO AND CMAKE_${lang}_COMPILER_ID STREQUAL "GNU")
execute_process(
COMMAND "${CMAKE_${lang}_COMPILER}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment