Imported Upstream version 3.20.2 upstream/3.20.2
authorDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 8 Oct 2021 00:20:48 +0000 (09:20 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 8 Oct 2021 00:20:48 +0000 (09:20 +0900)
25 files changed:
Help/command/file.rst
Help/command/if.rst
Help/manual/cmake-compile-features.7.rst
Help/manual/cmake.1.rst
Help/release/3.20.rst
Modules/CMakeDetermineCXXCompiler.cmake
Modules/CMakeFortranCompilerId.F.in
Modules/Compiler/Intel-DetermineCompiler.cmake
Modules/WriteCompilerDetectionHeader.cmake
Source/CMakeVersion.cmake
Source/cmLoadCommandCommand.cxx
Source/cmNinjaUtilityTargetGenerator.cxx
Source/cmQtAutoGenGlobalInitializer.cxx
Source/cmQtAutoMocUic.cxx
Source/cmStandardLexer.h
Source/cmSystemTools.cxx
Source/cmTimestamp.cxx
Source/cmake.cxx
Tests/QtAutogen/ObjectLibrary/CMakeLists.txt
Tests/RunCMake/CommandLine/build-bad-generator-stderr.txt
Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-target_post_build-debug-ninja-stdout.txt [new file with mode: 0644]
Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake
Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt
Utilities/KWIML/include/kwiml/abi.h

index 24e43e9..31de610 100644 (file)
@@ -922,7 +922,8 @@ system search path like ``$ENV{PATH}``.  A search path will be converted
 to a cmake-style list separated by ``;`` characters.
 
 The ``TO_NATIVE_PATH`` mode converts a cmake-style ``<path>`` into a native
-path with platform-specific slashes (``\`` on Windows and ``/`` elsewhere).
+path with platform-specific slashes (``\`` on Windows hosts and ``/``
+elsewhere).
 
 Always use double quotes around the ``<path>`` to be sure it is treated
 as a single argument to this command.
index f327ca9..fbf3e36 100644 (file)
@@ -153,7 +153,16 @@ File Operations
  only for full paths.
 
 ``if(IS_ABSOLUTE path)``
- True if the given path is an absolute path.
+ True if the given path is an absolute path.  Note the following special
+ cases:
+
+ * An empty ``path`` evaluates to false.
+ * On Windows hosts, any ``path`` that begins with a drive letter and colon
+   (e.g. ``C:``), a forward slash or a backslash will evaluate to true.
+   This means a path like ``C:no\base\dir`` will evaluate to true, even
+   though the non-drive part of the path is relative.
+ * On non-Windows hosts, any ``path`` that begins with a tilde (``~``)
+   evaluates to true.
 
 Comparisons
 """""""""""
index 0d15ddf..2c2b04c 100644 (file)
@@ -130,118 +130,21 @@ Optional Compile Features
 =========================
 
 Compile features may be preferred if available, without creating a hard
-requirement.  For example, a library may provides alternative
-implementations depending on whether the ``cxx_variadic_templates``
-feature is available:
-
-.. code-block:: c++
-
-  #if Foo_COMPILER_CXX_VARIADIC_TEMPLATES
-  template<int I, int... Is>
-  struct Interface;
-
-  template<int I>
-  struct Interface<I>
-  {
-    static int accumulate()
-    {
-      return I;
-    }
-  };
-
-  template<int I, int... Is>
-  struct Interface
-  {
-    static int accumulate()
-    {
-      return I + Interface<Is...>::accumulate();
-    }
-  };
-  #else
-  template<int I1, int I2 = 0, int I3 = 0, int I4 = 0>
-  struct Interface
-  {
-    static int accumulate() { return I1 + I2 + I3 + I4; }
-  };
-  #endif
-
-Such an interface depends on using the correct preprocessor defines for the
-compiler features.  CMake can generate a header file containing such
-defines using the :module:`WriteCompilerDetectionHeader` module.  The
-module contains the ``write_compiler_detection_header`` function which
-accepts parameters to control the content of the generated header file:
-
-.. code-block:: cmake
-
-  write_compiler_detection_header(
-    FILE "${CMAKE_CURRENT_BINARY_DIR}/foo_compiler_detection.h"
-    PREFIX Foo
-    COMPILERS GNU
-    FEATURES
-      cxx_variadic_templates
-  )
-
-Such a header file may be used internally in the source code of a project,
-and it may be installed and used in the interface of library code.
-
-For each feature listed in ``FEATURES``, a preprocessor definition
-is created in the header file, and defined to either ``1`` or ``0``.
-
-Additionally, some features call for additional defines, such as the
-``cxx_final`` and ``cxx_override`` features. Rather than being used in
-``#ifdef`` code, the ``final`` keyword is abstracted by a symbol
-which is defined to either ``final``, a compiler-specific equivalent, or
-to empty.  That way, C++ code can be written to unconditionally use the
-symbol, and compiler support determines what it is expanded to:
-
-.. code-block:: c++
-
-  struct Interface {
-    virtual void Execute() = 0;
-  };
-
-  struct Concrete Foo_FINAL {
-    void Execute() Foo_OVERRIDE;
-  };
-
-In this case, ``Foo_FINAL`` will expand to ``final`` if the
-compiler supports the keyword, or to empty otherwise.
-
-In this use-case, the CMake code will wish to enable a particular language
-standard if available from the compiler. The :prop_tgt:`CXX_STANDARD`
-target property variable may be set to the desired language standard
-for a particular target, and the :variable:`CMAKE_CXX_STANDARD` may be
-set to influence all following targets:
-
-.. code-block:: cmake
-
-  write_compiler_detection_header(
-    FILE "${CMAKE_CURRENT_BINARY_DIR}/foo_compiler_detection.h"
-    PREFIX Foo
-    COMPILERS GNU
-    FEATURES
-      cxx_final cxx_override
-  )
-
-  # Includes foo_compiler_detection.h and uses the Foo_FINAL symbol
-  # which will expand to 'final' if the compiler supports the requested
-  # CXX_STANDARD.
-  add_library(foo foo.cpp)
-  set_property(TARGET foo PROPERTY CXX_STANDARD 11)
-
-  # Includes foo_compiler_detection.h and uses the Foo_FINAL symbol
-  # which will expand to 'final' if the compiler supports the feature,
-  # even though CXX_STANDARD is not set explicitly.  The requirement of
-  # cxx_constexpr causes CMake to set CXX_STANDARD internally, which
-  # affects the compile flags.
-  add_library(foo_impl foo_impl.cpp)
-  target_compile_features(foo_impl PRIVATE cxx_constexpr)
-
-The ``write_compiler_detection_header`` function also creates compatibility
-code for other features which have standard equivalents.  For example, the
-``cxx_static_assert`` feature is emulated with a template and abstracted
-via the ``<PREFIX>_STATIC_ASSERT`` and ``<PREFIX>_STATIC_ASSERT_MSG``
-function-macros.
+requirement.   This can be achieved by *not* specifying features with
+:command:`target_compile_features` and instead checking the compiler
+capabilities with preprocessor conditions in project code.
+
+In this use-case, the project may wish to establish a particular language
+standard if available from the compiler, and use preprocessor conditions
+to detect the features actually available.  A language standard may be
+established by `Requiring Language Standards`_ using
+:command:`target_compile_features` with meta-features like ``cxx_std_11``,
+or by setting the :prop_tgt:`CXX_STANDARD` target property or
+:variable:`CMAKE_CXX_STANDARD` variable.
+
+See also policy :policy:`CMP0120` and legacy documentation on
+:ref:`Example Usage <WCDH Example Usage>` of the deprecated
+:module:`WriteCompilerDetectionHeader` module.
 
 Conditional Compilation Options
 ===============================
@@ -284,13 +187,12 @@ while a header at ``no_variadics/interface.h`` may contain:
     static int accumulate() { return I1 + I2 + I3 + I4; }
   };
 
-It would be possible to write a abstraction ``interface.h`` header
+It may be possible to write an abstraction ``interface.h`` header
 containing something like:
 
 .. code-block:: c++
 
-  #include "foo_compiler_detection.h"
-  #if Foo_COMPILER_CXX_VARIADIC_TEMPLATES
+  #ifdef HAVE_CXX_VARIADIC_TEMPLATES
   #include "with_variadics/interface.h"
   #else
   #include "no_variadics/interface.h"
index 157ea5f..02828ac 100644 (file)
@@ -105,6 +105,7 @@ Generator
   is already configured in the shell.  When using one of the
   :ref:`IDE Build Tool Generators`, no particular environment is needed.
 
+.. _`Generate a Project Buildsystem`:
 
 Generate a Project Buildsystem
 ==============================
index e452926..f77304f 100644 (file)
@@ -47,11 +47,7 @@ Compilers
   * The ``icx``/``icpx`` C/C++ compilers on Linux, and the ``icx``
     C/C++ compiler on Windows, are fully supported as of oneAPI 2021.1.
 
-  * The ``ifx`` Fortran compiler on Linux is partially supported.
-    As of oneAPI 2021.1, ``ifx`` does not define several identification
-    macros, so CMake identifies it as the classic ``Intel`` compiler.
-    This works in many cases because ``ifx`` accepts the same command line
-    parameters as ``ifort``.  A future version of oneAPI may fix this.
+  * The ``ifx`` Fortran compiler on Linux is supported as of oneAPI 2021.1.
 
   * The ``ifx`` Fortran compiler on Windows is not yet supported.
 
@@ -298,6 +294,10 @@ Deprecated and Removed Features
 Other Changes
 =============
 
+* When running :manual:`cmake(1)` to :ref:`Generate a Project Buildsystem`,
+  unknown command-line arguments starting with a hyphen (``-``) are now
+  rejected with an error.  Previously they were silently ignored.
+
 * Source file extensions must now be explicit.
   See policy :policy:`CMP0115` for details.
 
@@ -347,3 +347,18 @@ Changes made since CMake 3.20.0 include the following.
   iOS, tvOS and watchOS should now default to ``@rpath`` instead of using
   a full absolute path and failing at runtime when the library or framework
   is embedded in an application bundle (see :prop_tgt:`XCODE_EMBED_<type>`).
+
+3.20.2
+------
+
+* The Intel Classic 2021 compiler version numbers are now detected correctly
+  as having major version 2021.  CMake 3.20.1 and below were not aware of a
+  change to the identification macro version scheme made by Intel starting
+  in version 2021, and detected the version as 20.2.
+
+* The Intel oneAPI Fortran compiler is now identified as ``IntelLLVM``.
+  The oneAPI 2021.1 Fortran compiler is missing an identification macro,
+  so CMake 3.20.1 and below identified it as ``Intel``.  CMake now has
+  a special case to recognize oneAPI 2021.1 Fortran as ``IntelLLVM``.
+  The oneAPI 2021.2 Fortran compiler defines the proper identification
+  macro and so is identified as ``IntelLLVM`` by all CMake 3.20 versions.
index fd07a5c..3d1a7bb 100644 (file)
@@ -161,7 +161,7 @@ if (NOT _CMAKE_TOOLCHAIN_PREFIX)
 
   if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|QCC")
     get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)
-    if (COMPILER_BASENAME MATCHES "^(.+-)?(clang\\+\\+|g\\+\\+|clang-cl)(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$")
+    if (COMPILER_BASENAME MATCHES "^(.+-)?(clang\\+\\+|[gc]\\+\\+|clang-cl)(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$")
       set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
       set(_CMAKE_TOOLCHAIN_SUFFIX ${CMAKE_MATCH_3})
       set(_CMAKE_COMPILER_SUFFIX ${CMAKE_MATCH_5})
index 0f547e9..7aa385e 100644 (file)
 #  define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100)
 #  define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER     % 100)
 # endif
+#elif defined(__INTEL_COMPILER) && __INTEL_COMPILER == 201900
+        PRINT *, 'INFO:compiler[IntelLLVM]'
+! ifx 2021.1 forgot to define __INTEL_LLVM_COMPILER.
+! Instead it defines __INTEL_COMPILER == 201900.
+# define COMPILER_VERSION_MAJOR DEC(2021)
+# define COMPILER_VERSION_MINOR DEC(1)
+# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
+# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
 #elif defined(__INTEL_COMPILER) || defined(__ICC)
         PRINT *, 'INFO:compiler[Intel]'
-# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
-# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
-# if defined(__INTEL_COMPILER_UPDATE)
-#  define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
+! __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later.
+# if __INTEL_COMPILER < 2021
+#  define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
+#  define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
+#  if defined(__INTEL_COMPILER_UPDATE)
+#   define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
+#  else
+#   define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER   % 10)
+#  endif
 # else
-#  define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER   % 10)
+#  define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER)
+#  define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE)
+!  The third version component from --version is an update index,
+!  but no macro is provided for it.
+#  define COMPILER_VERSION_PATCH DEC(0)
 # endif
 # if defined(__INTEL_COMPILER_BUILD_DATE)
 #  define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
index c31aa77..3c1fde2 100644 (file)
@@ -2,16 +2,25 @@
 set(_compiler_id_pp_test "defined(__INTEL_COMPILER) || defined(__ICC)")
 
 set(_compiler_id_version_compute "
-  /* __INTEL_COMPILER = VRP */
-# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__INTEL_COMPILER/100)
-# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__INTEL_COMPILER/10 % 10)
-# if defined(__INTEL_COMPILER_UPDATE)
-#  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEL_COMPILER_UPDATE)
+  /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later,
+     except that a few beta releases use the old format with V=2021.  */
+# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111
+#  define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__INTEL_COMPILER/100)
+#  define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__INTEL_COMPILER/10 % 10)
+#  if defined(__INTEL_COMPILER_UPDATE)
+#   define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEL_COMPILER_UPDATE)
+#  else
+#   define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEL_COMPILER   % 10)
+#  endif
 # else
-#  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEL_COMPILER   % 10)
+#  define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__INTEL_COMPILER)
+#  define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__INTEL_COMPILER_UPDATE)
+   /* The third version component from --version is an update index,
+      but no macro is provided for it.  */
+#  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(0)
 # endif
 # if defined(__INTEL_COMPILER_BUILD_DATE)
-  /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
+   /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
 #  define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__INTEL_COMPILER_BUILD_DATE)
 # endif
 # if defined(_MSC_VER)
index 5e6828f..0e4e028 100644 (file)
@@ -245,6 +245,131 @@ library:
     PRIVATE
       CompatSupport_DEPRECATED=
   )
+
+.. _`WCDH Example Usage`:
+
+Example Usage
+=============
+
+.. note::
+
+  This section was migrated from the :manual:`cmake-compile-features(7)`
+  manual since it relies on the ``WriteCompilerDetectionHeader`` module
+  which is removed by policy :policy:`CMP0120`.
+
+Compile features may be preferred if available, without creating a hard
+requirement.  For example, a library may provide alternative
+implementations depending on whether the ``cxx_variadic_templates``
+feature is available:
+
+.. code-block:: c++
+
+  #if Foo_COMPILER_CXX_VARIADIC_TEMPLATES
+  template<int I, int... Is>
+  struct Interface;
+
+  template<int I>
+  struct Interface<I>
+  {
+    static int accumulate()
+    {
+      return I;
+    }
+  };
+
+  template<int I, int... Is>
+  struct Interface
+  {
+    static int accumulate()
+    {
+      return I + Interface<Is...>::accumulate();
+    }
+  };
+  #else
+  template<int I1, int I2 = 0, int I3 = 0, int I4 = 0>
+  struct Interface
+  {
+    static int accumulate() { return I1 + I2 + I3 + I4; }
+  };
+  #endif
+
+Such an interface depends on using the correct preprocessor defines for the
+compiler features.  CMake can generate a header file containing such
+defines using the :module:`WriteCompilerDetectionHeader` module.  The
+module contains the ``write_compiler_detection_header`` function which
+accepts parameters to control the content of the generated header file:
+
+.. code-block:: cmake
+
+  write_compiler_detection_header(
+    FILE "${CMAKE_CURRENT_BINARY_DIR}/foo_compiler_detection.h"
+    PREFIX Foo
+    COMPILERS GNU
+    FEATURES
+      cxx_variadic_templates
+  )
+
+Such a header file may be used internally in the source code of a project,
+and it may be installed and used in the interface of library code.
+
+For each feature listed in ``FEATURES``, a preprocessor definition
+is created in the header file, and defined to either ``1`` or ``0``.
+
+Additionally, some features call for additional defines, such as the
+``cxx_final`` and ``cxx_override`` features. Rather than being used in
+``#ifdef`` code, the ``final`` keyword is abstracted by a symbol
+which is defined to either ``final``, a compiler-specific equivalent, or
+to empty.  That way, C++ code can be written to unconditionally use the
+symbol, and compiler support determines what it is expanded to:
+
+.. code-block:: c++
+
+  struct Interface {
+    virtual void Execute() = 0;
+  };
+
+  struct Concrete Foo_FINAL {
+    void Execute() Foo_OVERRIDE;
+  };
+
+In this case, ``Foo_FINAL`` will expand to ``final`` if the
+compiler supports the keyword, or to empty otherwise.
+
+In this use-case, the project code may wish to enable a particular language
+standard if available from the compiler. The :prop_tgt:`CXX_STANDARD`
+target property may be set to the desired language standard for a particular
+target, and the :variable:`CMAKE_CXX_STANDARD` variable may be set to
+influence all following targets:
+
+.. code-block:: cmake
+
+  write_compiler_detection_header(
+    FILE "${CMAKE_CURRENT_BINARY_DIR}/foo_compiler_detection.h"
+    PREFIX Foo
+    COMPILERS GNU
+    FEATURES
+      cxx_final cxx_override
+  )
+
+  # Includes foo_compiler_detection.h and uses the Foo_FINAL symbol
+  # which will expand to 'final' if the compiler supports the requested
+  # CXX_STANDARD.
+  add_library(foo foo.cpp)
+  set_property(TARGET foo PROPERTY CXX_STANDARD 11)
+
+  # Includes foo_compiler_detection.h and uses the Foo_FINAL symbol
+  # which will expand to 'final' if the compiler supports the feature,
+  # even though CXX_STANDARD is not set explicitly.  The requirement of
+  # cxx_constexpr causes CMake to set CXX_STANDARD internally, which
+  # affects the compile flags.
+  add_library(foo_impl foo_impl.cpp)
+  target_compile_features(foo_impl PRIVATE cxx_constexpr)
+
+The ``write_compiler_detection_header`` function also creates compatibility
+code for other features which have standard equivalents.  For example, the
+``cxx_static_assert`` feature is emulated with a template and abstracted
+via the ``<PREFIX>_STATIC_ASSERT`` and ``<PREFIX>_STATIC_ASSERT_MSG``
+function-macros.
 #]=======================================================================]
 
 # Guard against inclusion by absolute path.
index 948452a..725b08e 100644 (file)
@@ -1,7 +1,7 @@
 # CMake version number components.
 set(CMake_VERSION_MAJOR 3)
 set(CMake_VERSION_MINOR 20)
-set(CMake_VERSION_PATCH 1)
+set(CMake_VERSION_PATCH 2)
 #set(CMake_VERSION_RC 0)
 set(CMake_VERSION_IS_DIRTY 0)
 
@@ -21,7 +21,7 @@ endif()
 
 if(NOT CMake_VERSION_NO_GIT)
   # If this source was exported by 'git archive', use its commit info.
-  set(git_info [==[9765ccfa71 CMake 3.20.1]==])
+  set(git_info [==[1ad4501ae9 CMake 3.20.2]==])
 
   # Otherwise, try to identify the current development source version.
   if(NOT git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* "
index 5a7b30f..2981ef8 100644 (file)
@@ -1,12 +1,12 @@
 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
    file Copyright.txt or https://cmake.org/licensing for details.  */
 
-#if !defined(_WIN32) && !defined(__sun)
+#if !defined(_WIN32) && !defined(__sun) && !defined(__OpenBSD__)
 // POSIX APIs are needed
 // NOLINTNEXTLINE(bugprone-reserved-identifier)
 #  define _POSIX_C_SOURCE 200809L
 #endif
-#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 // For isascii
 // NOLINTNEXTLINE(bugprone-reserved-identifier)
 #  define _XOPEN_SOURCE 700
index a18ca20..92c5b52 100644 (file)
@@ -173,7 +173,7 @@ void cmNinjaUtilityTargetGenerator::WriteUtilBuildStatements(
     std::string ccConfig;
     if (genTarget->Target->IsPerConfig() &&
         genTarget->GetType() != cmStateEnums::GLOBAL_TARGET) {
-      ccConfig = fileConfig;
+      ccConfig = config;
     }
     if (config == fileConfig ||
         gg->GetPerConfigUtilityTargets().count(genTarget->GetName())) {
index f79ffd4..f8d18f2 100644 (file)
@@ -97,6 +97,11 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer(
       }
       std::set<std::string> const& languages =
         target->GetAllConfigCompileLanguages();
+      // cmGeneratorTarget::GetAllConfigCompileLanguages caches the target's
+      // sources. Clear it so that OBJECT library targets that are AUTOGEN
+      // initialized after this target get their added mocs_compilation.cpp
+      // source acknowledged by this target.
+      target->ClearSourcesCache();
       if (languages.count("CSharp")) {
         // Don't process target if it's a CSharp target
         continue;
index 535f786..f583162 100644 (file)
@@ -564,8 +564,7 @@ private:
   // -- Generation
   bool CreateDirectories();
   // -- Support for depfiles
-  static std::vector<std::string> dependenciesFromDepFile(
-    const char* filePath);
+  std::vector<std::string> dependenciesFromDepFile(const char* filePath);
 
   // -- Settings
   BaseSettingsT BaseConst_;
@@ -2066,7 +2065,8 @@ void cmQtAutoMocUicT::JobCompileMocT::Process()
                             " does not exist.");
       return;
     }
-    this->CacheEntry->Moc.Depends = dependenciesFromDepFile(depfile.c_str());
+    this->CacheEntry->Moc.Depends =
+      this->Gen()->dependenciesFromDepFile(depfile.c_str());
   }
 }
 
@@ -2223,12 +2223,12 @@ void cmQtAutoMocUicT::JobDepFilesMergeT::Process()
                this->MessagePath(this->BaseConst().DepFile.c_str())));
   }
   auto processDepFile =
-    [](const std::string& mocOutputFile) -> std::vector<std::string> {
+    [this](const std::string& mocOutputFile) -> std::vector<std::string> {
     std::string f = mocOutputFile + ".d";
     if (!cmSystemTools::FileExists(f)) {
       return {};
     }
-    return dependenciesFromDepFile(f.c_str());
+    return this->Gen()->dependenciesFromDepFile(f.c_str());
   };
 
   std::vector<std::string> dependencies = this->initialDependencies();
@@ -2961,6 +2961,7 @@ bool cmQtAutoMocUicT::CreateDirectories()
 std::vector<std::string> cmQtAutoMocUicT::dependenciesFromDepFile(
   const char* filePath)
 {
+  std::lock_guard<std::mutex> guard(this->CMakeLibMutex_);
   auto const content = cmReadGccDepfile(filePath);
   if (!content || content->empty()) {
     return {};
index 1da8c98..b871f5f 100644 (file)
@@ -7,7 +7,8 @@
 // NOLINTNEXTLINE(bugprone-reserved-identifier)
 #  define _XOPEN_SOURCE 600
 #endif
-#if !defined(_POSIX_C_SOURCE) && !defined(_WIN32) && !defined(__sun)
+#if !defined(_POSIX_C_SOURCE) && !defined(_WIN32) && !defined(__sun) &&       \
+  !defined(__OpenBSD__)
 /* POSIX APIs are needed */
 // NOLINTNEXTLINE(bugprone-reserved-identifier)
 #  define _POSIX_C_SOURCE 200809L
@@ -17,7 +18,7 @@
 // NOLINTNEXTLINE(bugprone-reserved-identifier)
 #  define _XOPEN_SOURCE 600
 #endif
-#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 /* For isascii */
 // NOLINTNEXTLINE(bugprone-reserved-identifier)
 #  define _XOPEN_SOURCE 700
index 0807590..c1ce7ec 100644 (file)
@@ -1,13 +1,12 @@
 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
    file Copyright.txt or https://cmake.org/licensing for details.  */
 
-#if !defined(_WIN32) && !defined(__sun)
+#if !defined(_WIN32) && !defined(__sun) && !defined(__OpenBSD__)
 // POSIX APIs are needed
 // NOLINTNEXTLINE(bugprone-reserved-identifier)
 #  define _POSIX_C_SOURCE 200809L
 #endif
-#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) ||    \
-  defined(__QNX__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__QNX__)
 // For isascii
 // NOLINTNEXTLINE(bugprone-reserved-identifier)
 #  define _XOPEN_SOURCE 700
index b016530..056696d 100644 (file)
@@ -1,13 +1,12 @@
 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
    file Copyright.txt or https://cmake.org/licensing for details.  */
 
-#if !defined(_WIN32) && !defined(__sun)
+#if !defined(_WIN32) && !defined(__sun) && !defined(__OpenBSD__)
 // POSIX APIs are needed
 // NOLINTNEXTLINE(bugprone-reserved-identifier)
 #  define _POSIX_C_SOURCE 200809L
 #endif
-#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) ||    \
-  defined(__QNX__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__QNX__)
 // For isascii
 // NOLINTNEXTLINE(bugprone-reserved-identifier)
 #  define _XOPEN_SOURCE 700
index 4b57395..4d03821 100644 (file)
@@ -3210,8 +3210,8 @@ int cmake::Build(int jobs, std::string dir, std::vector<std::string> targets,
   }
   auto gen = this->CreateGlobalGenerator(*cachedGenerator);
   if (!gen) {
-    std::cerr << "Error: could create CMAKE_GENERATOR \"" << *cachedGenerator
-              << "\"\n";
+    std::cerr << "Error: could not create CMAKE_GENERATOR \""
+              << *cachedGenerator << "\"\n";
     return 1;
   }
   this->SetGlobalGenerator(std::move(gen));
@@ -3350,7 +3350,7 @@ bool cmake::Open(const std::string& dir, bool dryRun)
   std::unique_ptr<cmGlobalGenerator> gen =
     this->CreateGlobalGenerator(fullName);
   if (!gen) {
-    std::cerr << "Error: could create CMAKE_GENERATOR \"" << fullName
+    std::cerr << "Error: could not create CMAKE_GENERATOR \"" << fullName
               << "\"\n";
     return false;
   }
index ec204e7..e8af6c9 100644 (file)
@@ -16,3 +16,8 @@ target_compile_features(b PRIVATE ${QT_COMPILE_FEATURES})
 # Executable with OBJECT library generator expressions
 add_executable(someProgram main.cpp $<TARGET_OBJECTS:a> $<TARGET_OBJECTS:b>)
 target_link_libraries(someProgram ${QT_LIBRARIES})
+
+# Executable without its own AUTOMOC.
+add_executable(someProgram2 main.cpp)
+target_link_libraries(someProgram2 PRIVATE a b ${QT_LIBRARIES})
+set_property(TARGET someProgram2 PROPERTY AUTOMOC OFF)
index 1103407..9390d77 100644 (file)
@@ -1 +1 @@
-^Error: could create CMAKE_GENERATOR "Bad Generator"$
+^Error: could not create CMAKE_GENERATOR "Bad Generator"$
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-target_post_build-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-target_post_build-debug-ninja-stdout.txt
new file mode 100644 (file)
index 0000000..6bf0a49
--- /dev/null
@@ -0,0 +1,4 @@
+^\[1/2\] target_post_build
+target main build
+\[2/2\] Running utility command for target_post_build
+target post build$
index e49cc32..bb68a50 100644 (file)
@@ -189,3 +189,11 @@ add_custom_target(target_no_cross_byproduct
   COMMAND echo $<CONFIG> target_no_cross_byproduct.txt
   WORKING_DIRECTORY $<CONFIG>
   )
+
+add_custom_target(target_post_build
+  COMMENT target_post_build
+  COMMAND ${CMAKE_COMMAND} -E echo "target main build"
+  )
+add_custom_command(TARGET target_post_build POST_BUILD
+  COMMAND ${CMAKE_COMMAND} -E echo "target post build"
+  )
index 23b4aea..aa42739 100644 (file)
@@ -364,6 +364,8 @@ run_ninja(CustomCommandOutputGenex target_no_cross_byproduct-debug build-Debug.n
 run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean)
 run_ninja(CustomCommandOutputGenex target_no_cross_byproduct-debug-in-release-graph build-Release.ninja target_no_cross_byproduct:Debug)
 run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean)
+# target_post_build
+run_ninja(CustomCommandOutputGenex target_post_build-debug build-Debug.ninja target_post_build)
 unset(RunCMake_TEST_NO_CLEAN)
 
 unset(RunCMake_TEST_BINARY_DIR)
index cb1a2e5..69230b6 100644 (file)
@@ -10,4 +10,10 @@ CMake Error at OwnSources.cmake:[0-9]+ \(add_library\):
 Call Stack \(most recent call first\):
   CMakeLists.txt:[0-9]+ \(include\)
 +
+CMake Error at OwnSources.cmake:[0-9]+ \(add_library\):
+  The SOURCES of "A" use a generator expression that depends on the SOURCES
+  themselves.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]+ \(include\)
++
 CMake Generate step failed\.  Build files cannot be regenerated correctly\.$
index 1112cb0..0437854 100644 (file)
@@ -409,6 +409,10 @@ suppression macro KWIML_ABI_NO_VERIFY was defined.
 #elif defined(__hppa) || defined(__hppa__)
 # define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG
 
+/* LoongArch64 */
+#elif defined(__loongarch64)
+# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE
+
 /* Motorola 68k */
 #elif defined(__m68k__) || defined(M68000)
 # define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG