summaryrefslogtreecommitdiff
path: root/Modules/CMakeTestSwiftCompiler.cmake
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2019-05-08 21:01:47 -0700
committerBrad King <brad.king@kitware.com>2019-05-16 14:41:05 -0400
commite9b0063e8e0f2fcb5cc4239a06deec17c49688c4 (patch)
treef1eeefa3765c4908d7bae093b2d165106b6e64c8 /Modules/CMakeTestSwiftCompiler.cmake
parentb6412e3e38ba22bf816445f19394e7c8027c186f (diff)
downloadcmake-e9b0063e8e0f2fcb5cc4239a06deec17c49688c4.tar.gz
Modules: add build rules for Swift Ninja support
Add rules to support building Swift sources using Ninja.
Diffstat (limited to 'Modules/CMakeTestSwiftCompiler.cmake')
-rw-r--r--Modules/CMakeTestSwiftCompiler.cmake7
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/CMakeTestSwiftCompiler.cmake b/Modules/CMakeTestSwiftCompiler.cmake
index 858c1be799..841aee643f 100644
--- a/Modules/CMakeTestSwiftCompiler.cmake
+++ b/Modules/CMakeTestSwiftCompiler.cmake
@@ -1,7 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-
if(CMAKE_Swift_COMPILER_FORCED)
# The compiler configuration was forced by the user.
# Assume the user has configured all compiler information.
@@ -23,7 +22,6 @@ unset(CMAKE_Swift_COMPILER_WORKS CACHE)
if(NOT CMAKE_Swift_COMPILER_WORKS)
PrintTestCompilerStatus("Swift" "")
file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.swift
- "import Foundation\n"
"print(\"CMake\")\n")
try_compile(CMAKE_Swift_COMPILER_WORKS ${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.swift
@@ -51,6 +49,11 @@ else()
"Determining if the Swift compiler works passed with "
"the following output:\n${__CMAKE_Swift_COMPILER_OUTPUT}\n\n")
endif()
+
+ # Re-configure to save learned information.
+ configure_file(${CMAKE_ROOT}/Modules/CMakeSwiftCompiler.cmake.in
+ ${CMAKE_PLATFORM_INFO_DIR}/CMakeSwiftCompiler.cmake @ONLY)
+ include(${CMAKE_PLATFORM_INFO_DIR}/CMakeSwiftCompiler.cmake)
endif()
unset(__CMAKE_Swift_COMPILER_OUTPUT)