summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeTestSwiftCompiler.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/CMakeTestSwiftCompiler.cmake')
-rw-r--r--Modules/CMakeTestSwiftCompiler.cmake8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/CMakeTestSwiftCompiler.cmake b/Modules/CMakeTestSwiftCompiler.cmake
index 2f2546f..88a864c 100644
--- a/Modules/CMakeTestSwiftCompiler.cmake
+++ b/Modules/CMakeTestSwiftCompiler.cmake
@@ -21,13 +21,12 @@ unset(CMAKE_Swift_COMPILER_WORKS CACHE)
# any makefiles or projects.
if(NOT CMAKE_Swift_COMPILER_WORKS)
PrintTestCompilerStatus("Swift")
- file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.swift
- "print(\"CMake\")\n")
# Clear result from normal variable.
unset(CMAKE_Swift_COMPILER_WORKS)
# Puts test result in cache variable.
- try_compile(CMAKE_Swift_COMPILER_WORKS ${CMAKE_BINARY_DIR}
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.swift
+ set(__CMAKE_Swift_TEST_SOURCE "print(\"CMake\")\n")
+ try_compile(CMAKE_Swift_COMPILER_WORKS
+ SOURCE_FROM_VAR main.swift __CMAKE_Swift_TEST_SOURCE
OUTPUT_VARIABLE __CMAKE_Swift_COMPILER_OUTPUT)
# Move result from cache to normal variable.
set(CMAKE_Swift_COMPILER_WORKS ${CMAKE_Swift_COMPILER_WORKS})
@@ -64,4 +63,5 @@ else()
include(${CMAKE_PLATFORM_INFO_DIR}/CMakeSwiftCompiler.cmake)
endif()
+unset(__CMAKE_Swift_TEST_SOURCE)
unset(__CMAKE_Swift_COMPILER_OUTPUT)