Skip to content

Commit 5d2dd07

Browse files
committed
[build] Allow CMAKE_Swift_COMPILER to be overriden.
If `CMAKE_Swift_COMPILER` is defined, the build script will now use that.
1 parent d9110de commit 5d2dd07

File tree

1 file changed

+5
-3
lines changed
  • utils/swift_build_support/swift_build_support

1 file changed

+5
-3
lines changed

utils/swift_build_support/swift_build_support/cmake.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,18 @@ def common_options(self, product=None):
141141

142142
if self.prefer_just_built_toolchain and product:
143143
toolchain_path = product.install_toolchain_path(args.host_target)
144+
cmake_swiftc_path = os.getenv('CMAKE_Swift_COMPILER',
145+
os.path.join(toolchain_path, 'bin', 'swiftc'))
144146
define("CMAKE_C_COMPILER:PATH", os.path.join(toolchain_path,
145147
'bin', 'clang'))
146148
define("CMAKE_CXX_COMPILER:PATH", os.path.join(toolchain_path,
147149
'bin', 'clang++'))
148-
define("CMAKE_Swift_COMPILER:PATH", os.path.join(toolchain_path,
149-
'bin', 'swiftc'))
150+
define("CMAKE_Swift_COMPILER:PATH", cmake_swiftc_path)
150151
else:
152+
cmake_swiftc_path = os.getenv('CMAKE_Swift_COMPILER', toolchain.swiftc)
151153
define("CMAKE_C_COMPILER:PATH", toolchain.cc)
152154
define("CMAKE_CXX_COMPILER:PATH", toolchain.cxx)
153-
define("CMAKE_Swift_COMPILER:PATH", toolchain.swiftc)
155+
define("CMAKE_Swift_COMPILER:PATH", cmake_swiftc_path)
154156
define("CMAKE_LIBTOOL:PATH", toolchain.libtool)
155157
define("CMAKE_AR:PATH", toolchain.ar)
156158
define("CMAKE_RANLIB:PATH", toolchain.ranlib)

0 commit comments

Comments
 (0)