mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-08 14:50:10 -06:00
Swift: disallow multiple CMAKE_OSX_ARCHITECTURES with Swift
This disallows the use of multiple values in `CMAKE_OSX_ARCHITECTURES` with Swift which does not support FAT compilation.
This commit is contained in:
@@ -660,6 +660,17 @@ bool cmGlobalNinjaGenerator::CheckLanguages(
|
||||
if (cmContains(languages, "Fortran")) {
|
||||
return this->CheckFortran(mf);
|
||||
}
|
||||
if (cmContains(languages, "Swift")) {
|
||||
const std::string architectures =
|
||||
mf->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES");
|
||||
if (architectures.find_first_of(';') != std::string::npos) {
|
||||
mf->IssueMessage(MessageType::FATAL_ERROR,
|
||||
"multiple values for CMAKE_OSX_ARCHITECTURES not "
|
||||
"supported with Swift");
|
||||
cmSystemTools::SetFatalErrorOccured();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@ if(RunCMake_GENERATOR STREQUAL Xcode)
|
||||
elseif(RunCMake_GENERATOR STREQUAL Ninja)
|
||||
if(CMAKE_Swift_COMPILER)
|
||||
run_cmake(Win32ExecutableDisallowed)
|
||||
|
||||
set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Darwin)
|
||||
run_cmake(SwiftMultiArch)
|
||||
unset(RunCMake_TEST_OPTIONS)
|
||||
endif()
|
||||
else()
|
||||
run_cmake(NotSupported)
|
||||
|
||||
1
Tests/RunCMake/Swift/SwiftMultiArch-result.txt
Normal file
1
Tests/RunCMake/Swift/SwiftMultiArch-result.txt
Normal file
@@ -0,0 +1 @@
|
||||
1
|
||||
4
Tests/RunCMake/Swift/SwiftMultiArch-stderr.txt
Normal file
4
Tests/RunCMake/Swift/SwiftMultiArch-stderr.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
^CMake Error at SwiftMultiArch.cmake:3 \(project\):
|
||||
multiple values for CMAKE_OSX_ARCHITECTURES not supported with Swift
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3
|
||||
4
Tests/RunCMake/Swift/SwiftMultiArch.cmake
Normal file
4
Tests/RunCMake/Swift/SwiftMultiArch.cmake
Normal file
@@ -0,0 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.15.1)
|
||||
set(CMAKE_OSX_ARCHITECTURES "armv7;arm64;i386;x86_64")
|
||||
project(SwiftMultiArch
|
||||
LANGUAGES Swift)
|
||||
Reference in New Issue
Block a user