CMake cannot detect swift compiler in OS Ventura

Hi, I’m working on macOS and have updated my OS version recently. when I try to build swift based library generated from cmake, I fail on the following line


since the compiler couldn’t be found (although I’ve properly installed Xcode+developer tools)
Here’s the relevant output

-- The Swift compiler identification is unknown
-- Configuring incomplete, errors occurred!
See also "/Users/me/myProj/CMakeFiles/CMakeOutput.log".
See also "/Users/me/myProj/CMakeFiles/CMakeError.log".
CMake Error at CMakeLists.txt:17 (enable_language):
No CMAKE_Swift_COMPILER could be found

Here’s my swift compiler location

❯ xcrun swift -version
Apple Swift version 5.7.2 (swiftlang- clang-1400.0.29.51)
Target: arm64-apple-darwin22.2.0
❯ xcrun --find swift

Perhaps there’s a way to explicitly set the compiler pointer ?

Thanks !

Can you attach the contents of the CMakeOutput.log and CMakeError.log files mentioned in your output?

Also make sure you’ve started up the Xcode IDE at least once after you updated. I vaguely recall sometimes needing to accept a license or install additional components in the past and this affected the ability of command line tools being able to build things.

1 Like

Thanks! Running the xcode UI for the first time fixed the unknown compiler issue.