cmake: fix build error with Xcode 9 on macOS 12