diff options
-rw-r--r-- | Help/release/3.18.rst | 14 | ||||
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 6 | ||||
-rw-r--r-- | Modules/CompilerId/Xcode-3.pbxproj.in | 1 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 3 | ||||
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 19 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 18 | ||||
-rw-r--r-- | Source/cmStandardLexer.h | 4 | ||||
-rw-r--r-- | Tests/SwiftOnly/CMakeLists.txt | 1 | ||||
-rwxr-xr-x | bootstrap | 6 |
11 files changed, 70 insertions, 9 deletions
diff --git a/Help/release/3.18.rst b/Help/release/3.18.rst index 386b61b..427840e 100644 --- a/Help/release/3.18.rst +++ b/Help/release/3.18.rst @@ -318,3 +318,17 @@ Other Changes * The :manual:`cmake-file-api(7)` "codemodel" version 2 "target" object gained a new ``precompileHeaders`` field in the ``compileGroups`` objects. + +Updates +======= + +Changes made since CMake 3.18.0 include the following. + +3.18.1 +------ + +* The :generator:`Xcode` generator, when :variable:`CMAKE_OSX_ARCHITECTURES` + is not defined, now selects ``$(NATIVE_ARCH_ACTUAL)`` as the default + architecture (the Xcode ``ARCHS`` setting). This is needed for Xcode 12 + to select the host's architecture, which older versions of Xcode did + by default. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index df48fa5..44332a6 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -469,6 +469,12 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_clang_cxx_library "CLANG_CXX_LIBRARY = \"${CMAKE_MATCH_3}\";") endif() endif() + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_OSX_SYSROOT MATCHES "^$|[Mm][Aa][Cc][Oo][Ss]") + # When targeting macOS, use only the host architecture. + set(id_archs [[ARCHS = "$(NATIVE_ARCH_ACTUAL)";]]) + else() + set(id_archs "") + endif() configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-3.pbxproj.in ${id_dir}/CompilerId${lang}.xcodeproj/project.pbxproj @ONLY) unset(_ENV_MACOSX_DEPLOYMENT_TARGET) diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in index 672044e..6fe17e5 100644 --- a/Modules/CompilerId/Xcode-3.pbxproj.in +++ b/Modules/CompilerId/Xcode-3.pbxproj.in @@ -84,6 +84,7 @@ CODE_SIGNING_REQUIRED = NO; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; SYMROOT = .; + @id_archs@ @id_toolset@ @id_lang_version@ @id_clang_cxx_library@ diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index f2011ee..c7baf2b 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1309,6 +1309,9 @@ void AddSwiftImplicitIncludeDirectories( for (const cmLinkImplItem& library : libraries->Libraries) { if (const cmGeneratorTarget* dependency = library.Target) { + if (dependency->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + continue; + } if (cm::contains(dependency->GetAllConfigCompileLanguages(), "Swift")) { EvaluatedTargetPropertyEntry entry{ library, library.Backtrace }; diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 358d65a..97580d6 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -550,8 +550,9 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) */ for (auto& sg : groupFilesList) { std::ostream* fout; - bool useProjectFile = cmIsOn(*this->GeneratorTarget->GetProperty( - "GHS_NO_SOURCE_GROUP_FILE")) || + cmProp noSourceGroupFile = + this->GeneratorTarget->GetProperty("GHS_NO_SOURCE_GROUP_FILE"); + bool useProjectFile = (noSourceGroupFile && cmIsOn(*noSourceGroupFile)) || cmIsOn(this->Makefile->GetDefinition("CMAKE_GHS_NO_SOURCE_GROUP_FILE")); if (useProjectFile || sg.empty()) { fout = &fout_proj; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index a5ce5d1..65828ce 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -12,6 +12,7 @@ #include <cm/memory> #include <cmext/algorithm> +#include <cmext/string_view> #include "cmsys/RegularExpression.hxx" @@ -271,6 +272,13 @@ std::string cmGlobalXCodeGenerator::FindXcodeBuildCommand() return makeProgram; } +bool cmGlobalXCodeGenerator::SetSystemName(std::string const& s, + cmMakefile* mf) +{ + this->SystemName = s; + return this->cmGlobalGenerator::SetSystemName(s, mf); +} + bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts, bool build, cmMakefile* mf) { @@ -3111,6 +3119,14 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( if (archs.empty()) { // Tell Xcode to use NATIVE_ARCH instead of ARCHS. buildSettings->AddAttribute("ONLY_ACTIVE_ARCH", this->CreateString("YES")); + // When targeting macOS, use only the host architecture. + if (this->SystemName == "Darwin"_s && + (!sysroot || !*sysroot || + cmSystemTools::LowerCase(sysroot).find("macos") != + std::string::npos)) { + buildSettings->AddAttribute("ARCHS", + this->CreateString("$(NATIVE_ARCH_ACTUAL)")); + } } else { // Tell Xcode to use ARCHS (ONLY_ACTIVE_ARCH defaults to NO). buildSettings->AddAttribute("ARCHS", this->CreateString(archs)); @@ -3210,7 +3226,8 @@ void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf) } if (this->Architectures.empty()) { - // With no ARCHS we use ONLY_ACTIVE_ARCH. + // With no ARCHS we use ONLY_ACTIVE_ARCH and possibly a + // platform-specific default ARCHS placeholder value. // Look up the arch that Xcode chooses in this case. if (const char* arch = mf->GetDefinition("CMAKE_XCODE_ARCHS")) { this->ObjectDirArchDefault = arch; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index e380f1c..e2d1b3a 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -109,6 +109,7 @@ public: bool ShouldStripResourcePath(cmMakefile*) const override; + bool SetSystemName(std::string const& s, cmMakefile* mf) override; bool SetGeneratorToolset(std::string const& ts, bool build, cmMakefile* mf) override; void AppendFlag(std::string& flags, std::string const& flag) const; @@ -298,6 +299,7 @@ private: std::vector<std::string> Architectures; std::string ObjectDirArchDefault; std::string ObjectDirArch; + std::string SystemName; std::string GeneratorToolset; std::map<cmGeneratorTarget const*, size_t> TargetOrderIndex; }; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index b92548f..0f01f85 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -733,8 +733,13 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement( static_cast<int>(cmSystemTools::CalculateCommandLineLengthLimit()) - globalGen->GetRuleCmdLength(this->LanguageLinkerDeviceRule(config)); - build.RspFile = this->ConvertToNinjaPath(std::string("CMakeFiles/") + - genTarget->GetName() + ".rsp"); + std::string path = localGen.GetHomeRelativeOutputPath(); + if (!path.empty()) { + path += '/'; + } + build.RspFile = this->ConvertToNinjaPath( + cmStrCat(path, "CMakeFiles/", genTarget->GetName(), + globalGen->IsMultiConfig() ? cmStrCat('.', config) : "", ".rsp")); // Gather order-only dependencies. this->GetLocalGenerator()->AppendTargetDepends( @@ -1154,8 +1159,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( globalGen->GetRuleCmdLength(linkBuild.Rule); } - linkBuild.RspFile = this->ConvertToNinjaPath(std::string("CMakeFiles/") + - gt->GetName() + ".rsp"); + std::string path = localGen.GetHomeRelativeOutputPath(); + if (!path.empty()) { + path += '/'; + } + linkBuild.RspFile = this->ConvertToNinjaPath( + cmStrCat(path, "CMakeFiles/", gt->GetName(), + globalGen->IsMultiConfig() ? cmStrCat('.', config) : "", ".rsp")); // Gather order-only dependencies. this->GetLocalGenerator()->AppendTargetDepends(gt, linkBuild.OrderOnlyDeps, diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h index cc67ac2..e0b2116 100644 --- a/Source/cmStandardLexer.h +++ b/Source/cmStandardLexer.h @@ -3,6 +3,10 @@ #ifndef cmStandardLexer_h #define cmStandardLexer_h +#if defined(__linux) +/* Needed for glibc < 2.12 */ +# define _XOPEN_SOURCE 600 +#endif #if !defined(_WIN32) && !defined(__sun) /* POSIX APIs are needed */ # define _POSIX_C_SOURCE 200809L diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt index e24279b..41d14ea 100644 --- a/Tests/SwiftOnly/CMakeLists.txt +++ b/Tests/SwiftOnly/CMakeLists.txt @@ -35,3 +35,4 @@ target_link_libraries(N PUBLIC # Dummy to make sure generation works with such targets. add_library(SwiftIface INTERFACE) +target_link_libraries(SwiftOnly PRIVATE SwiftIface) @@ -622,6 +622,8 @@ Configuration: --no-system-bzip2 use cmake-provided bzip2 library (default) --system-liblzma use system-installed liblzma library --no-system-liblzma use cmake-provided liblzma library (default) + --system-nghttp2 use system-installed nghttp2 library + --no-system-nghttp2 use cmake-provided nghttp2 library (default) --system-zstd use system-installed zstd library --no-system-zstd use cmake-provided zstd library (default) --system-libarchive use system-installed libarchive library @@ -866,10 +868,10 @@ while test $# != 0; do --init=*) cmake_init_file=`cmake_arg "$1"` ;; --system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;; --no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;; - --system-bzip2|--system-curl|--system-expat|--system-jsoncpp|--system-libarchive|--system-librhash|--system-zlib|--system-liblzma|--system-zstd|--system-libuv) + --system-bzip2|--system-curl|--system-expat|--system-jsoncpp|--system-libarchive|--system-librhash|--system-zlib|--system-liblzma|--system-nghttp2|--system-zstd|--system-libuv) lib=`cmake_arg "$1" "--system-"` cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=1" ;; - --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-jsoncpp|--no-system-libarchive|--no-system-librhash|--no-system-zlib|--no-system-liblzma|--no-system-zstd|--no-system-libuv) + --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-jsoncpp|--no-system-libarchive|--no-system-librhash|--no-system-zlib|--no-system-liblzma|--no-system-nghttp2|--no-system-zstd|--no-system-libuv) lib=`cmake_arg "$1" "--no-system-"` cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=0" ;; --qt-gui) cmake_bootstrap_qt_gui="1" ;; |