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/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 3 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 19 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmStandardLexer.h | 4 | ||||
-rw-r--r-- | Tests/FindPackageModeMakefileTest/Makefile.in | 2 | ||||
-rw-r--r-- | Tests/RunCMake/RunCMake.cmake | 1 | ||||
-rw-r--r-- | Tests/SwiftOnly/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Utilities/std/cm/bits/fs_path.cxx | 60 | ||||
-rw-r--r-- | Utilities/std/cm/filesystem | 16 | ||||
-rwxr-xr-x | bootstrap | 6 |
14 files changed, 115 insertions, 22 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 ebfd5a4..8200200 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -490,6 +490,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/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a31d8c1..a015db9 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 18) -set(CMake_VERSION_PATCH 20200717) +set(CMake_VERSION_PATCH 20200721) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 72dc80b..4fe68d2 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1365,6 +1365,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/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 360807c..e54de5d 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" @@ -272,6 +273,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) { @@ -3375,6 +3383,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)); @@ -3480,7 +3496,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 276a9ee..7018de7 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; @@ -301,6 +302,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; std::vector<std::string> EnabledLangs; 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/FindPackageModeMakefileTest/Makefile.in b/Tests/FindPackageModeMakefileTest/Makefile.in index 5ef67d0..af9fa96 100644 --- a/Tests/FindPackageModeMakefileTest/Makefile.in +++ b/Tests/FindPackageModeMakefileTest/Makefile.in @@ -24,7 +24,7 @@ main.o: clean main.cpp pngtest: main.o @$(CMAKE_FOO) -DMODE=LINK >$(tmp) @foo="`cat $(tmp)`"; \ - printf '"%s" %s %s -o pngtest main.o %s\n' $(CMAKE_CXX_COMPILER) "$(CMAKE_CXX_FLAGS)" "$(LDFLAGS)" "$$foo" >$(tmp) + printf '"%s" %s %s %s -o pngtest main.o %s\n' $(CMAKE_CXX_COMPILER) "$(CMAKE_CXX_FLAGS)" "$(__EXTRA_OSX_SYSROOT_FLAGS)" "$(LDFLAGS)" "$$foo" >$(tmp) @cat $(tmp) @sh $(tmp) @rm -f $(tmp) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index cb20fb1..c13c694 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -154,6 +154,7 @@ function(run_cmake test) "|[^\n]*xcodebuild[^\n]*warning: file type[^\n]*is based on missing file type" "|[^\n]*is a member of multiple groups" + "|[^\n]*offset in archive not a multiple of 8" "|[^\n]*from Time Machine by path" "|[^\n]*Bullseye Testing Technology" ")[^\n]*\n)+" 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) diff --git a/Utilities/std/cm/bits/fs_path.cxx b/Utilities/std/cm/bits/fs_path.cxx index 71386bb..b8c5631 100644 --- a/Utilities/std/cm/bits/fs_path.cxx +++ b/Utilities/std/cm/bits/fs_path.cxx @@ -13,8 +13,10 @@ # include <string> # include <utility> # include <vector> -# if defined(_WIN32) +# if defined(_WIN32) && !defined(__CYGWIN__) # include <cctype> +# endif +# if defined(_WIN32) || defined(__CYGWIN__) # include <iterator> # endif @@ -396,7 +398,7 @@ private: pointer consume_root_name(pointer ptr, pointer end, bool check_only = false) noexcept { -# if defined(_WIN32) +# if defined(_WIN32) && !defined(__CYGWIN__) if (ptr < end) { if ((end - ptr) >= 2 && this->is_drive_name(ptr)) { // Drive letter (X:) is a root name @@ -409,7 +411,8 @@ private: (ptr[1] == '/' || ptr[1] == '\\') && (ptr[2] != '/' && ptr[2] != '\\')) { // server name (//server) is a root name - auto pos = std::find(ptr + 2, end, '/'); + auto pos = std::find_if(ptr + 2, end, + [](char c) { return c == '/' || c == '\\'; }); if (!check_only) { this->Entry = cm::string_view(ptr, pos - ptr); } @@ -438,6 +441,31 @@ private: } } } +# elif defined(__CYGWIN__) + if (ptr < end) { + if ((end - ptr) > 2 && ptr[0] == '/' && ptr[1] == '/' && ptr[2] != '/') { + // server name (//server) is a root name + auto pos = std::find(ptr + 2, end, '/'); + if (!check_only) { + this->Entry = cm::string_view(ptr, pos - ptr); + } + return pos; + } + } else { + if ((ptr - end) > 2 && ptr[0] != '/') { + std::reverse_iterator<pointer> start(ptr); + std::reverse_iterator<pointer> stop(end); + auto res = std::find(start, stop, '/'); + pointer pos = res.base() - 1; + if ((pos - 1) > end && pos[-1] == '/') { + // server name (//server) is a root name + if (!check_only) { + this->Entry = cm::string_view(pos - 1, ptr - pos + 2); + } + return pos - 2; + } + } + } # else (void)ptr; (void)end; @@ -514,13 +542,25 @@ path& path::operator/=(const path& p) this->path_ += static_cast<std::string>(p.get_root_directory()); } else if (this->has_filename()) { this->path_ += this->preferred_separator; -# if defined(_WIN32) +# if defined(_WIN32) || defined(__CYGWIN__) // special case: "//host" / "b" => "//host/b" } else if (this->has_root_name() && !this->has_root_directory()) { if (this->path_.length() >= 3 && - (this->path_[0] == '/' || this->path_[0] == '\\') && - (this->path_[1] == '/' || this->path_[1] == '\\') && - (this->path_[2] != '/' || this->path_[2] != '\\')) { + (this->path_[0] == '/' +# if defined(_WIN32) && !defined(__CYGWIN__) + || this->path_[0] == '\\' +# endif + ) && + (this->path_[1] == '/' +# if defined(_WIN32) && !defined(__CYGWIN__) + || this->path_[1] == '\\' +# endif + ) && + (this->path_[2] != '/' +# if defined(_WIN32) && !defined(__CYGWIN__) + && this->path_[2] != '\\' +# endif + )) { this->path_ += this->preferred_separator; } # endif @@ -644,7 +684,7 @@ path path::lexically_relative(const path& base) const } auto is_path_absolute = [](cm::string_view rn, cm::string_view rd) -> bool { -# if defined(_WIN32) +# if defined(_WIN32) && !defined(__CYGWIN__) return !rn.empty() && !rd.empty(); # else (void)rn; @@ -659,7 +699,7 @@ path path::lexically_relative(const path& base) const return path(); } -# if defined(_WIN32) +# if defined(_WIN32) && !defined(__CYGWIN__) // LWG3070 handle special case: filename can also be a root-name auto is_drive_name = [](cm::string_view item) -> bool { return item.length() == 2 && item[1] == ':'; @@ -724,7 +764,7 @@ path::path_type path::get_generic() const { auto gen_path = this->path_; auto start = gen_path.begin(); -# if defined(_WIN32) +# if defined(_WIN32) && !defined(__CYGWIN__) std::replace(gen_path.begin(), gen_path.end(), '\\', '/'); // preserve special syntax for root_name ('//server' or '//?') if (gen_path.length() > 2 && gen_path[2] != '/') { diff --git a/Utilities/std/cm/filesystem b/Utilities/std/cm/filesystem index d7ade34..6021712 100644 --- a/Utilities/std/cm/filesystem +++ b/Utilities/std/cm/filesystem @@ -27,7 +27,7 @@ # include <cm/type_traits> # include <cmext/iterator> -# if defined(_WIN32) +# if defined(_WIN32) && !defined(__CYGWIN__) # include <algorithm> # endif @@ -616,7 +616,7 @@ class path }; public: -# if defined(_WIN32) +# if defined(_WIN32) && !defined(__CYGWIN__) using value_type = wchar_t; # else using value_type = char; @@ -633,7 +633,7 @@ public: generic_format }; -# if defined(_WIN32) +# if defined(_WIN32) && !defined(__CYGWIN__) static constexpr value_type preferred_separator = L'\\'; # else static constexpr value_type preferred_separator = '/'; @@ -800,7 +800,7 @@ public: path& make_preferred() { -# if defined(_WIN32) +# if defined(_WIN32) && !defined(__CYGWIN__) std::replace( this->path_.begin(), this->path_.end(), '/', static_cast<path_type::value_type>(this->preferred_separator)); @@ -845,7 +845,7 @@ public: // ================ const string_type& native() const noexcept { -# if defined(_WIN32) +# if defined(_WIN32) && !defined(__CYGWIN__) this->native_path_ = internals::string_converter< path_type::value_type>::to<string_type::value_type>(this->path_); return this->native_path_; @@ -990,9 +990,11 @@ public: bool is_absolute() const { -# if defined(_WIN32) +# if defined(_WIN32) && !defined(__CYGWIN__) return this->has_root_name() && this->has_root_directory(); # else + // For CYGWIN, root_name (i.e. //host or /cygdrive/x) is not considered. + // Same as current GNU g++ implementation (9.3). return this->has_root_directory(); # endif } @@ -1085,7 +1087,7 @@ private: int compare_path(cm::string_view str) const; path_type path_; -# if defined(_WIN32) +# if defined(_WIN32) && !defined(__CYGWIN__) mutable string_type native_path_; # endif }; @@ -625,6 +625,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 @@ -872,10 +874,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" ;; --bootstrap-system-libuv) bootstrap_system_libuv="1" ;; |