diff options
26 files changed, 148 insertions, 111 deletions
diff --git a/.gitlab/ci/docker/debian10/Dockerfile b/.gitlab/ci/docker/debian10/Dockerfile index 3ebee87..34a4bf1 100644 --- a/.gitlab/ci/docker/debian10/Dockerfile +++ b/.gitlab/ci/docker/debian10/Dockerfile @@ -16,9 +16,6 @@ MAINTAINER Ben Boeckel <ben.boeckel@kitware.com> COPY install_deps.sh /root/install_deps.sh RUN sh /root/install_deps.sh -COPY install_clang_tidy.sh /root/install_clang_tidy.sh -RUN sh /root/install_clang_tidy.sh - COPY --from=iwyu-build /root/iwyu.tar.gz /root/iwyu.tar.gz RUN tar -C / -xf /root/iwyu.tar.gz RUN ln -s /usr/lib/llvm-6.0/bin/include-what-you-use /usr/bin/include-what-you-use-6.0 diff --git a/.gitlab/ci/docker/debian10/install_clang_tidy.sh b/.gitlab/ci/docker/debian10/install_clang_tidy.sh deleted file mode 100755 index 1280f1e..0000000 --- a/.gitlab/ci/docker/debian10/install_clang_tidy.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -set -e - -# clang-tidy headers -apt-get install -y \ - gnupg2 -GNUPGHOME=$(mktemp -d) -export GNUPGHOME -keyid=6084F3CF814B57C1CF12EFD515CF4D18AF4F7421 -gpg2 --keyserver hkps://keyserver.ubuntu.com --recv-keys "$keyid" -gpg2 -o /usr/share/keyrings/llvm.gpg --export "$keyid" -rm -rf "$GNUPGHOME" -unset GNUPGHOME -echo 'deb [signed-by=/usr/share/keyrings/llvm.gpg] http://apt.llvm.org/buster/ llvm-toolchain-buster-14 main' > /etc/apt/sources.list.d/llvm.list -apt-get update -apt-get install -y \ - clang-tidy-14 \ - libclang-14-dev - -apt-get clean diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index 6ac1995..a46ec22 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -45,7 +45,7 @@ ### Debian .debian10: - image: "kitware/cmake:ci-debian10-x86_64-2022-09-22" + image: "kitware/cmake:ci-debian10-x86_64-2022-08-30" variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml index 5632f6d..1803846 100644 --- a/.gitlab/os-macos.yml +++ b/.gitlab/os-macos.yml @@ -7,7 +7,7 @@ GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci ext/$CI_CONCURRENT_ID" # TODO: Factor this out so that each job selects the Xcode version to # use so that different versions can be tested in a single pipeline. - DEVELOPER_DIR: "/Applications/Xcode-13.4.app/Contents/Developer" + DEVELOPER_DIR: "/Applications/Xcode-14.0.app/Contents/Developer" # Avoid conflicting with other projects running on the same machine. SCCACHE_SERVER_PORT: 4227 @@ -95,7 +95,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos - shell - - xcode-13.4 + - xcode-14.0 - nonconcurrent .macos_x86_64_builder_tags_package: @@ -103,7 +103,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos - shell - - xcode-13.4 + - xcode-14.0 - nonconcurrent - finder @@ -112,7 +112,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos - shell - - xcode-13.4 + - xcode-14.0 - concurrent .macos_arm64_builder_tags: @@ -120,7 +120,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-arm64 - shell - - xcode-13.4 + - xcode-14.0 - nonconcurrent .macos_arm64_builder_ext_tags: @@ -128,7 +128,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-arm64 - shell - - xcode-13.4 + - xcode-14.0 - concurrent ## macOS-specific scripts diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0868d28..bb5420b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 24) -set(CMake_VERSION_PATCH 20220929) +set(CMake_VERSION_PATCH 20221003) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 7f1e426..53cb030 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -5454,9 +5454,6 @@ std::string cmGeneratorTarget::GetObjectDirectory( std::string obj_dir = this->GlobalGenerator->ExpandCFGIntDir(this->ObjectDirectory, config); #if defined(__APPLE__) - // find and replace $(PROJECT_NAME) xcode placeholder - const std::string projectName = this->LocalGenerator->GetProjectName(); - cmSystemTools::ReplaceString(obj_dir, "$(PROJECT_NAME)", projectName); // Replace Xcode's placeholder for the object file directory since // installation and export scripts need to know the real directory. // Xcode has build-time settings (e.g. for sanitizers) that affect this, diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 9739a4e..6b867d4 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -607,7 +607,6 @@ std::string cmGlobalXCodeGenerator::PostBuildMakeTarget( } #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK" -#define OBJECT_LIBRARY_ARTIFACT_DIR std::string() void cmGlobalXCodeGenerator::AddExtraTargets( cmLocalGenerator* root, std::vector<cmLocalGenerator*>& gens) @@ -2405,8 +2404,13 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // Add preprocessor definitions for this target and configuration. BuildObjectListOrString ppDefs(this, true); - this->AppendDefines( - ppDefs, "CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\""); + if (languages.count("Swift")) { + // FIXME: Xcode warns that Swift does not support definition values. + // C/CXX sources mixed in Swift targets will not see CMAKE_INTDIR. + } else { + this->AppendDefines( + ppDefs, "CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\""); + } if (const std::string* exportMacro = gtgt->GetExportMacro()) { // Add the export symbol definition for shared library objects. this->AppendDefines(ppDefs, exportMacro->c_str()); @@ -2518,18 +2522,28 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, soName += *soversion; } + if (gtgt->CanCompileSources()) { + std::string tmpDir = + cmStrCat(gtgt->GetSupportDirectory(), '/', this->GetCMakeCFGIntDir()); + buildSettings->AddAttribute("TARGET_TEMP_DIR", this->CreateString(tmpDir)); + + std::string outDir; + if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) { + // We cannot suppress the archive, so hide it with intermediate files. + outDir = tmpDir; + } else { + outDir = gtgt->GetDirectory(configName); + } + buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR", + this->CreateString(outDir)); + } + // Set attributes to specify the proper name for the target. std::string pndir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory(); if (gtgt->GetType() == cmStateEnums::STATIC_LIBRARY || gtgt->GetType() == cmStateEnums::SHARED_LIBRARY || gtgt->GetType() == cmStateEnums::MODULE_LIBRARY || gtgt->GetType() == cmStateEnums::EXECUTABLE) { - if (!gtgt->UsesDefaultOutputDir(configName, - cmStateEnums::RuntimeBinaryArtifact)) { - std::string pncdir = gtgt->GetDirectory(configName); - buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR", - this->CreateString(pncdir)); - } if (gtgt->IsFrameworkOnApple() || gtgt->IsCFBundleOnApple()) { pnprefix = ""; @@ -2539,20 +2553,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CreateString(pnprefix)); buildSettings->AddAttribute("EXECUTABLE_SUFFIX", this->CreateString(pnsuffix)); - } else if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) { - pnprefix = "lib"; - pnbase = gtgt->GetName(); - pnsuffix = ".a"; - - std::string pncdir = this->GetObjectsDirectory( - this->CurrentProject, configName, gtgt, OBJECT_LIBRARY_ARTIFACT_DIR); - buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR", - this->CreateString(pncdir)); } // Store the product name for all target types. buildSettings->AddAttribute("PRODUCT_NAME", this->CreateString(realName)); - buildSettings->AddAttribute("SYMROOT", this->CreateString(pndir)); // Handle settings for each target type. switch (gtgt->GetType()) { @@ -4465,16 +4469,6 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( return true; } -std::string cmGlobalXCodeGenerator::GetObjectsDirectory( - const std::string& projName, const std::string& configName, - const cmGeneratorTarget* t, const std::string& variant) const -{ - std::string dir = cmStrCat( - t->GetLocalGenerator()->GetCurrentBinaryDirectory(), '/', projName, - ".build/", configName, '/', t->GetName(), ".build/", variant); - return dir; -} - void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf) { this->Architectures.clear(); @@ -4598,10 +4592,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( for (auto objLib : objlibs) { const std::string objLibName = objLib->GetName(); - std::string d = cmStrCat( - this->GetObjectsDirectory(this->CurrentProject, configName, objLib, - OBJECT_LIBRARY_ARTIFACT_DIR), - "lib", objLibName, ".a"); + std::string d = cmStrCat(objLib->GetSupportDirectory(), '/', + configName, "/lib", objLibName, ".a"); std::string dependency = this->ConvertToRelativeForMake(d); makefileStream << "\\\n\t" << dependency; @@ -4615,8 +4607,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( // if building for more than one architecture // then remove those executables as well if (this->Architectures.size() > 1) { - std::string universal = this->GetObjectsDirectory( - this->CurrentProject, configName, gt, "$(OBJDIR)/"); + std::string universal = cmStrCat(gt->GetSupportDirectory(), '/', + configName, "/$(OBJDIR)/"); for (const auto& architecture : this->Architectures) { std::string universalFile = cmStrCat(universal, architecture, '/', gt->GetFullName(configName)); @@ -5013,14 +5005,10 @@ bool cmGlobalXCodeGenerator::ShouldStripResourcePath(cmMakefile*) const void cmGlobalXCodeGenerator::ComputeTargetObjectDirectory( cmGeneratorTarget* gt) const { - std::string configName = this->GetCMakeCFGIntDir(); auto objectDirArch = GetTargetObjectDirArch(*gt, this->ObjectDirArch); - - std::string dir = - cmStrCat(this->GetObjectsDirectory("$(PROJECT_NAME)", configName, gt, - "$(OBJECT_FILE_DIR_normal:base)/"), - objectDirArch, '/'); - gt->ObjectDirectory = dir; + gt->ObjectDirectory = + cmStrCat(gt->GetSupportDirectory(), '/', this->GetCMakeCFGIntDir(), + "/$(OBJECT_FILE_DIR_normal:base)/", objectDirArch, '/'); } std::string cmGlobalXCodeGenerator::GetDeploymentPlatform(const cmMakefile* mf) diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 92e4528..e924169 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -339,11 +339,6 @@ private: std::string GetLibraryOrFrameworkPath(const std::string& path) const; - std::string GetObjectsDirectory(const std::string& projName, - const std::string& configName, - const cmGeneratorTarget* t, - const std::string& variant) const; - static std::string GetDeploymentPlatform(const cmMakefile* mf); void ComputeArchitectures(cmMakefile* mf); diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 428bbff..6c5ab7f 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -298,7 +298,16 @@ add_RunCMake_test(CompilerNotFound) if (APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") list(APPEND CompilerTest_ARGS -DCMake_TEST_OBJC=1) endif() +if(CMAKE_Fortran_COMPILER) + list(APPEND CompilerTest_ARGS -DCMake_TEST_Fortran=1) +endif() +foreach(lang IN ITEMS CUDA HIP ISPC) + if(CMake_TEST_${lang}) + list(APPEND CompilerTest_ARGS -DCMake_TEST_${lang}=1) + endif() +endforeach() add_RunCMake_test(CompilerTest) +set_property(TEST RunCMake.CompilerTest APPEND PROPERTY LABELS "CUDA" "HIP" "ISPC") add_RunCMake_test(Configure -DMSVC_IDE=${MSVC_IDE}) add_RunCMake_test(DisallowedCommands) if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") diff --git a/Tests/RunCMake/CompilerTest/CUDA-stdout.txt b/Tests/RunCMake/CompilerTest/CUDA-stdout.txt new file mode 100644 index 0000000..00d35df --- /dev/null +++ b/Tests/RunCMake/CompilerTest/CUDA-stdout.txt @@ -0,0 +1,2 @@ +-- Check for working CUDA compiler: [^ +]* - works diff --git a/Tests/RunCMake/CompilerTest/CUDA.cmake b/Tests/RunCMake/CompilerTest/CUDA.cmake new file mode 100644 index 0000000..e8c19a0 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/CUDA.cmake @@ -0,0 +1,3 @@ +# Pretend the ABI check failed in order to force the fall-back test to run. +set(CMAKE_CUDA_ABI_COMPILED FALSE) +enable_language(CUDA) diff --git a/Tests/RunCMake/CompilerTest/Fortran-stdout.txt b/Tests/RunCMake/CompilerTest/Fortran-stdout.txt new file mode 100644 index 0000000..d871fea --- /dev/null +++ b/Tests/RunCMake/CompilerTest/Fortran-stdout.txt @@ -0,0 +1,2 @@ +-- Check for working Fortran compiler: [^ +]* - works diff --git a/Tests/RunCMake/CompilerTest/Fortran.cmake b/Tests/RunCMake/CompilerTest/Fortran.cmake new file mode 100644 index 0000000..8c83bd7 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/Fortran.cmake @@ -0,0 +1,3 @@ +# Pretend the ABI check failed in order to force the fall-back test to run. +set(CMAKE_Fortran_ABI_COMPILED FALSE) +enable_language(Fortran) diff --git a/Tests/RunCMake/CompilerTest/HIP-stdout.txt b/Tests/RunCMake/CompilerTest/HIP-stdout.txt new file mode 100644 index 0000000..8b3baa7 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/HIP-stdout.txt @@ -0,0 +1,2 @@ +-- Check for working HIP compiler: [^ +]* - works diff --git a/Tests/RunCMake/CompilerTest/HIP.cmake b/Tests/RunCMake/CompilerTest/HIP.cmake new file mode 100644 index 0000000..e56b77a --- /dev/null +++ b/Tests/RunCMake/CompilerTest/HIP.cmake @@ -0,0 +1,3 @@ +# Pretend the ABI check failed in order to force the fall-back test to run. +set(CMAKE_HIP_ABI_COMPILED FALSE) +enable_language(HIP) diff --git a/Tests/RunCMake/CompilerTest/ISPC-stdout.txt b/Tests/RunCMake/CompilerTest/ISPC-stdout.txt new file mode 100644 index 0000000..7e45c91 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/ISPC-stdout.txt @@ -0,0 +1,3 @@ +-- The ISPC compiler identification is [^ +]* +-- Configuring done diff --git a/Tests/RunCMake/CompilerTest/ISPC.cmake b/Tests/RunCMake/CompilerTest/ISPC.cmake new file mode 100644 index 0000000..3ce7b28 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/ISPC.cmake @@ -0,0 +1,3 @@ +# Pretend the ABI check failed in order to force the fall-back test to run. +set(CMAKE_ISPC_ABI_COMPILED FALSE) +enable_language(ISPC) diff --git a/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake b/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake index 995296a..2dd9c7f 100644 --- a/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake @@ -3,6 +3,22 @@ include(RunCMake) run_cmake(C) run_cmake(CXX) +if(CMake_TEST_CUDA) + run_cmake(CUDA) +endif() + +if(CMake_TEST_Fortran) + run_cmake(Fortran) +endif() + +if(CMake_TEST_HIP) + run_cmake(HIP) +endif() + +if(CMake_TEST_ISPC) + run_cmake(ISPC) +endif() + if(CMake_TEST_OBJC) run_cmake(OBJC) run_cmake(OBJCXX) diff --git a/Tests/RunCMake/XcodeProject/Clean.cmake b/Tests/RunCMake/XcodeProject/Clean.cmake new file mode 100644 index 0000000..1ab7e10 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/Clean.cmake @@ -0,0 +1,2 @@ +enable_language(C) +add_subdirectory(Clean) diff --git a/Tests/RunCMake/XcodeProject/Clean/CMakeLists.txt b/Tests/RunCMake/XcodeProject/Clean/CMakeLists.txt new file mode 100644 index 0000000..59e62cb --- /dev/null +++ b/Tests/RunCMake/XcodeProject/Clean/CMakeLists.txt @@ -0,0 +1 @@ +add_library(empty empty.c) diff --git a/Tests/RunCMake/XcodeProject/Clean/empty.c b/Tests/RunCMake/XcodeProject/Clean/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/Clean/empty.c diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index d20f5a6..d97807b 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -1,5 +1,13 @@ include(RunCMake) +function(RunClean) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Clean-build) + run_cmake(Clean) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(Clean-build xcodebuild clean) +endfunction() +RunClean() + run_cmake(ExplicitCMakeLists) run_cmake(ImplicitCMakeLists) run_cmake(InterfaceLibSources) @@ -290,30 +298,33 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 6) unset(RunCMake_TEST_OPTIONS) # XcodeIOSInstallCombinedPrune - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedPrune-build) - set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS - "-DCMAKE_SYSTEM_NAME=iOS" - "-DCMAKE_IOS_INSTALL_COMBINED=YES" - "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") + # FIXME(#24011): Xcode 14 removed support for older architectures the test needs. + if(XCODE_VERSION VERSION_LESS 14) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedPrune-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_SYSTEM_NAME=iOS" + "-DCMAKE_IOS_INSTALL_COMBINED=YES" + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - run_cmake(XcodeIOSInstallCombinedPrune) - run_cmake_command(XcodeIOSInstallCombinedPrune-build ${CMAKE_COMMAND} --build .) - if(XCODE_VERSION VERSION_LESS 12) - run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install) + run_cmake(XcodeIOSInstallCombinedPrune) + run_cmake_command(XcodeIOSInstallCombinedPrune-build ${CMAKE_COMMAND} --build .) + if(XCODE_VERSION VERSION_LESS 12) + run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install) + endif() + # --build defaults to Debug, --install defaults to Release, so we have to + # specify the configuration explicitly + run_cmake_command(XcodeIOSInstallCombinedPrune-cmakeinstall + ${CMAKE_COMMAND} --install . --config Debug + ) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) endif() - # --build defaults to Debug, --install defaults to Release, so we have to - # specify the configuration explicitly - run_cmake_command(XcodeIOSInstallCombinedPrune-cmakeinstall - ${CMAKE_COMMAND} --install . --config Debug - ) - - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) - unset(RunCMake_TEST_OPTIONS) # XcodeIOSInstallCombinedSingleArch set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedSingleArch-build) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake index 53b885d..60bc0d8 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake @@ -9,11 +9,18 @@ function(verify_architectures file) return() endif() - string(REGEX MATCHALL "\narchitecture [^ \n\t()]+" architectures ${otool_out}) + string(REGEX MATCHALL "\narchitecture [^ \n\t()]+" architectures "${otool_out}") string(REPLACE "\narchitecture " "" actual "${architectures}") list(SORT actual) - set(expected arm64 armv7 i386 x86_64) + if(XCODE_VERSION VERSION_LESS 14) + set(maybe_armv7 armv7) + set(maybe_i386 i386) + else() + set(maybe_armv7 "") + set(maybe_i386 "") + endif() + set(expected arm64 ${maybe_armv7} ${maybe_i386} x86_64) if(NOT actual STREQUAL expected) message(SEND_ERROR diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake index 19f8e2f..8426148 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake @@ -2,7 +2,13 @@ cmake_minimum_required(VERSION 3.3) project(IOSInstallCombined CXX) -if(XCODE_VERSION VERSION_GREATER_EQUAL 9) +set(maybe_armv7 armv7) +set(maybe_i386 i386) +if(XCODE_VERSION VERSION_GREATER_EQUAL 14) + set(CMAKE_OSX_DEPLOYMENT_TARGET 16) + set(maybe_armv7 "") + set(maybe_i386 "") +elseif(XCODE_VERSION VERSION_GREATER_EQUAL 9) set(CMAKE_OSX_DEPLOYMENT_TARGET 10) endif() @@ -16,7 +22,7 @@ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") -set(CMAKE_OSX_ARCHITECTURES "armv7;arm64;i386;x86_64") +set(CMAKE_OSX_ARCHITECTURES ${maybe_armv7} arm64 ${maybe_i386} x86_64) add_executable(foo_app MACOSX_BUNDLE main.cpp) install(TARGETS foo_app BUNDLE DESTINATION bin) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake index 3c11ae0..db8f869 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake @@ -12,7 +12,11 @@ function(verify_architecture file) string(REGEX MATCHALL "is architecture: [^ \n\t]+" architecture "${lipo_out}") string(REGEX REPLACE "is architecture: " "" actual "${architecture}") - set(expected armv7) + if(XCODE_VERSION VERSION_GREATER_EQUAL 14) + set(expected arm64) + else() + set(expected armv7) + endif() if(NOT actual STREQUAL expected) message(SEND_ERROR diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake index 974ae47..5177ec2 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake @@ -2,7 +2,11 @@ cmake_minimum_required(VERSION 3.3) project(XcodeIOSInstallCombinedSingleArch CXX) -if(XCODE_VERSION VERSION_GREATER_EQUAL 9) +set(iphoneos_arch armv7) +if(XCODE_VERSION VERSION_GREATER_EQUAL 14) + set(CMAKE_OSX_DEPLOYMENT_TARGET 16) + set(iphoneos_arch arm64) +elseif(XCODE_VERSION VERSION_GREATER_EQUAL 9) set(CMAKE_OSX_DEPLOYMENT_TARGET 10) endif() @@ -17,8 +21,8 @@ install(TARGETS foo DESTINATION lib) set_target_properties( foo PROPERTIES - XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] armv7 - XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] armv7 + XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] ${iphoneos_arch} + XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] ${iphoneos_arch} XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "" XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "" ) |