summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:20:48 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:20:48 +0900
commit4109a3583f8051b5c32f09af58eb6b6bef7fad15 (patch)
tree9206d8b8966ebded44a125dad94d5f8edce08ea4
parentd8d99d7e7a4052f3fa2132d17074cc65ad8bb5a6 (diff)
downloadcmake-4109a3583f8051b5c32f09af58eb6b6bef7fad15.tar.gz
cmake-4109a3583f8051b5c32f09af58eb6b6bef7fad15.tar.bz2
cmake-4109a3583f8051b5c32f09af58eb6b6bef7fad15.zip
Imported Upstream version 3.20.2upstream/3.20.2
-rw-r--r--Help/command/file.rst3
-rw-r--r--Help/command/if.rst11
-rw-r--r--Help/manual/cmake-compile-features.7.rst132
-rw-r--r--Help/manual/cmake.1.rst1
-rw-r--r--Help/release/3.20.rst25
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake2
-rw-r--r--Modules/CMakeFortranCompilerId.F.in27
-rw-r--r--Modules/Compiler/Intel-DetermineCompiler.cmake23
-rw-r--r--Modules/WriteCompilerDetectionHeader.cmake125
-rw-r--r--Source/CMakeVersion.cmake4
-rw-r--r--Source/cmLoadCommandCommand.cxx4
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.cxx2
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.cxx5
-rw-r--r--Source/cmQtAutoMocUic.cxx11
-rw-r--r--Source/cmStandardLexer.h5
-rw-r--r--Source/cmSystemTools.cxx5
-rw-r--r--Source/cmTimestamp.cxx5
-rw-r--r--Source/cmake.cxx6
-rw-r--r--Tests/QtAutogen/ObjectLibrary/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/CommandLine/build-bad-generator-stderr.txt2
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-target_post_build-debug-ninja-stdout.txt4
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake8
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt6
-rw-r--r--Utilities/KWIML/include/kwiml/abi.h4
25 files changed, 270 insertions, 157 deletions
diff --git a/Help/command/file.rst b/Help/command/file.rst
index 24e43e93c..31de610b2 100644
--- a/Help/command/file.rst
+++ b/Help/command/file.rst
@@ -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.
diff --git a/Help/command/if.rst b/Help/command/if.rst
index f327ca943..fbf3e363f 100644
--- a/Help/command/if.rst
+++ b/Help/command/if.rst
@@ -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
"""""""""""
diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst
index 0d15ddfc3..2c2b04cbe 100644
--- a/Help/manual/cmake-compile-features.7.rst
+++ b/Help/manual/cmake-compile-features.7.rst
@@ -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"
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 157ea5f9d..02828ac5b 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -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
==============================
diff --git a/Help/release/3.20.rst b/Help/release/3.20.rst
index e452926be..f77304fcf 100644
--- a/Help/release/3.20.rst
+++ b/Help/release/3.20.rst
@@ -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.
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index fd07a5c47..3d1a7bba2 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -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})
diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in
index 0f547e934..7aa385ed5 100644
--- a/Modules/CMakeFortranCompilerId.F.in
+++ b/Modules/CMakeFortranCompilerId.F.in
@@ -36,14 +36,31 @@
# 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)
diff --git a/Modules/Compiler/Intel-DetermineCompiler.cmake b/Modules/Compiler/Intel-DetermineCompiler.cmake
index c31aa7752..3c1fde202 100644
--- a/Modules/Compiler/Intel-DetermineCompiler.cmake
+++ b/Modules/Compiler/Intel-DetermineCompiler.cmake
@@ -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)
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
index 5e6828f3b..0e4e02805 100644
--- a/Modules/WriteCompilerDetectionHeader.cmake
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -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.
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 948452a8f..725b08ee5 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 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]* "
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index 5a7b30f19..2981ef877 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -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
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx
index a18ca20d5..92c5b521b 100644
--- a/Source/cmNinjaUtilityTargetGenerator.cxx
+++ b/Source/cmNinjaUtilityTargetGenerator.cxx
@@ -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())) {
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx
index f79ffd4a0..f8d18f27a 100644
--- a/Source/cmQtAutoGenGlobalInitializer.cxx
+++ b/Source/cmQtAutoGenGlobalInitializer.cxx
@@ -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;
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 535f786f4..f5831628d 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -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 {};
diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h
index 1da8c9844..b871f5fca 100644
--- a/Source/cmStandardLexer.h
+++ b/Source/cmStandardLexer.h
@@ -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
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 080759077..c1ce7ec98 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -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
diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx
index b01653009..056696d4b 100644
--- a/Source/cmTimestamp.cxx
+++ b/Source/cmTimestamp.cxx
@@ -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
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 4b5739572..4d0382116 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -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;
}
diff --git a/Tests/QtAutogen/ObjectLibrary/CMakeLists.txt b/Tests/QtAutogen/ObjectLibrary/CMakeLists.txt
index ec204e775..e8af6c983 100644
--- a/Tests/QtAutogen/ObjectLibrary/CMakeLists.txt
+++ b/Tests/QtAutogen/ObjectLibrary/CMakeLists.txt
@@ -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)
diff --git a/Tests/RunCMake/CommandLine/build-bad-generator-stderr.txt b/Tests/RunCMake/CommandLine/build-bad-generator-stderr.txt
index 110340749..9390d776c 100644
--- a/Tests/RunCMake/CommandLine/build-bad-generator-stderr.txt
+++ b/Tests/RunCMake/CommandLine/build-bad-generator-stderr.txt
@@ -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
index 000000000..6bf0a49f3
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-target_post_build-debug-ninja-stdout.txt
@@ -0,0 +1,4 @@
+^\[1/2\] target_post_build
+target main build
+\[2/2\] Running utility command for target_post_build
+target post build$
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake
index e49cc32fb..bb68a509e 100644
--- a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake
@@ -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"
+ )
diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
index 23b4aea48..aa427391e 100644
--- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
@@ -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)
diff --git a/Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt b/Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt
index cb1a2e5c8..69230b63f 100644
--- a/Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt
+++ b/Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt
@@ -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\.$
diff --git a/Utilities/KWIML/include/kwiml/abi.h b/Utilities/KWIML/include/kwiml/abi.h
index 1112cb0e4..0437854d3 100644
--- a/Utilities/KWIML/include/kwiml/abi.h
+++ b/Utilities/KWIML/include/kwiml/abi.h
@@ -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