Skip to content

Commit

Permalink
Merge branch 'release-3.27.2' into zh_CN
Browse files Browse the repository at this point in the history
  • Loading branch information
gwankyun committed Aug 11, 2023
2 parents 23d24c1 + f3d9a82 commit e3f8130
Show file tree
Hide file tree
Showing 54 changed files with 378 additions and 518 deletions.
2 changes: 2 additions & 0 deletions .gitlab/os-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -622,3 +622,5 @@
-DCMake_SPHINX_CMAKE_ORG_OUTDATED=$CMAKE_CI_SPHINX_OUTDATED
-DCMake_VERSION_NO_GIT=$CMAKE_CI_VERSION_NO_GIT
- ninja
# FIXME(#25175): non-main index entries are scored too high.
- sed -i '/search for explicit entries in index directives/,/^$/d' html/_static/searchtools.js
6 changes: 5 additions & 1 deletion Help/command/add_custom_command.rst
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ The options are:

.. versionadded:: 3.27

Indicate that the command's ``DEPENDS`` argument represents all files
Indicates that the command's ``DEPENDS`` argument represents all files
required by the command and implicit dependencies are not required.

Without this option, if any target uses the output of the custom command,
Expand All @@ -376,6 +376,10 @@ The options are:
Only the :ref:`Ninja Generators` actually use this information to remove
unnecessary implicit dependencies.

See also the :prop_tgt:`OPTIMIZE_DEPENDENCIES` target property, which may
provide another way for reducing the impact of target dependencies in some
scenarios.

Examples: Generating Files
^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
6 changes: 3 additions & 3 deletions Help/command/if.rst
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ File Operations

.. signature:: if(EXISTS <path-to-file-or-directory>)

True if the named file or directory exists. Behavior is well-defined
only for explicit full paths (a leading ``~/`` is not expanded as
a home directory and is considered a relative path).
True if the named file or directory exists and is readable. Behavior
is well-defined only for explicit full paths (a leading ``~/`` is not
expanded as a home directory and is considered a relative path).
Resolves symbolic links, i.e. if the named file or directory is a
symbolic link, returns true if the target of the symbolic link exists.

Expand Down
4 changes: 2 additions & 2 deletions Help/guide/importing-exporting/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ CMake在何处安装这些目标。
add_executable(myexe src1.c src2.c )
target_link_libraries(myexe PRIVATE MathFunctions::MathFunctions)
第1行加载目标CMake文件。尽管我们只导出了一个目标,但该文件可以导入任意数量的目标。它们的位置\
是相对于文件位置计算的,以便可以容易地移动安装树。第3行引用了导入的\ ``MathFunctions``\
第2行加载目标CMake文件。尽管我们只导出了一个目标,但该文件可以导入任意数量的目标。它们的位置\
是相对于文件位置计算的,以便可以容易地移动安装树。第4行引用了导入的\ ``MathFunctions``\
库。生成的构建系统将从库的安装位置链接到库。

可执行文件也可以使用相同的过程导出和导入。
Expand Down
4 changes: 2 additions & 2 deletions Help/manual/cmake-generator-expressions.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1986,8 +1986,8 @@ Shell路径
文件。有关详细信息,请参阅\ :ref:`add_library导入库 <add_library imported libraries>`\
部分。许多查找模块生成\ ``UNKNOWN``\ 类型的导入目标,因此将被忽略。

在支持运行时路径(\ ``RPATH``\ )的平台上,请参考\ :prop_tgt:`INSTALL_RPATH`\ 目标属性。\
在Apple平台上,请参考\ :prop_tgt:`INSTALL_NAME_DIR`\ 目标属性。
在支持运行时路径(\ ``RPATH``\ )的平台上,请参考\ :prop_tgt:`INSTALL_RPATH`\ 目标属性。\
在Apple平台上,请参考\ :prop_tgt:`INSTALL_NAME_DIR`\ 目标属性。

.. genex:: $<TARGET_RUNTIME_DLL_DIRS:tgt>

Expand Down
53 changes: 28 additions & 25 deletions Help/prop_tgt/ENABLE_EXPORTS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,33 @@ varies by platform:
referencing the executable since the dynamic loader will
automatically bind symbols when the module is loaded.

This property is initialized by the value of the variable
:variable:`CMAKE_EXECUTABLE_ENABLE_EXPORTS` if it is set when an executable
target is created.
This property is initialized by the value of the
:variable:`CMAKE_EXECUTABLE_ENABLE_EXPORTS` variable, if it is set when an
executable target is created. If :variable:`CMAKE_EXECUTABLE_ENABLE_EXPORTS`
is not set, the :variable:`CMAKE_ENABLE_EXPORTS` variable is used to initialize
the property instead for backward compatibility reasons.
See below for alternative initialization behavior for shared library targets.

.. versionadded:: 3.27
On macOS, to link with a shared library (standard one as well as framework),
a linker import file (e.g. a text-based stubs file, with ``.tbd`` extension)
can be used instead of the shared library itself.

The generation of these linker import files, as well as the consumption, is
controlled by this property. When this property is set to true, CMake will
generate a ``.tbd`` file for each shared library created by
:command:`add_library` command. This allow other targets to use this ``.tbd``
file to link to the library with the :command:`target_link_libraries`
command.

.. note::

For compatibility purpose, this property will be ignored if
:prop_tgt:`XCODE_ATTRIBUTE_GENERATE_TEXT_BASED_STUBS <XCODE_ATTRIBUTE_<an-attribute>>`
target property or the
:variable:`CMAKE_XCODE_ATTRIBUTE_GENERATE_TEXT_BASED_STUBS <CMAKE_XCODE_ATTRIBUTE_<an-attribute>>`
variable is set to ``NO``.

This property is initialized by the value of the variable
:variable:`CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS` if it is set when a shared
library target is created.
On Apple platforms, to link with a shared library (either a bare library or a
framework), a linker import file can be used instead of the actual shared
library. These linker import files are also known as text-based stubs, and
they have a ``.tbd`` file extension.

The generation of these linker import files, as well as their consumption, is
controlled by this property. When this property is set to true on a shared
library target, CMake will generate a ``.tbd`` file for the library.
Other targets that link to the shared library target will then use this
``.tbd`` file when linking rather than linking to the shared library binary.

.. note::

For backward compatibility reasons, this property will be ignored if the
:prop_tgt:`XCODE_ATTRIBUTE_GENERATE_TEXT_BASED_STUBS <XCODE_ATTRIBUTE_<an-attribute>>`
target property or the
:variable:`CMAKE_XCODE_ATTRIBUTE_GENERATE_TEXT_BASED_STUBS <CMAKE_XCODE_ATTRIBUTE_<an-attribute>>`
variable is set to false.

For shared library targets, this property is initialized by the value of the
:variable:`CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS` variable, if it is set when
the target is created.
18 changes: 17 additions & 1 deletion Help/release/3.27.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Generators
linker will cause a relink if they change (typically modified timestamps).
See the :variable:`CMAKE_LINK_DEPENDS_USE_LINKER` variable.

* The :ref:`Visual Studio Generators` for VS 2015 and above learned to
* The :ref:`Visual Studio Generators` for VS 14 (2015) and above learned to
select the Windows SDK version explicitly using a ``version=`` field
in the :variable:`CMAKE_GENERATOR_PLATFORM` variable.
See :ref:`Visual Studio Platform Selection`.
Expand Down Expand Up @@ -257,6 +257,9 @@ Other Changes
* :ref:`Visual Studio Generators`, for VS 15.8 (2017) and newer, now
build custom commands in parallel. See policy :policy:`CMP0147`.

* :ref:`Visual Studio Generators` for VS 14 (2015) and above now prefer
to select the latest Windows SDK version. See policy :policy:`CMP0149`.

Updates
=======

Expand All @@ -268,3 +271,16 @@ Changes made since CMake 3.27.0 include the following.
* This version made no changes to documented features or interfaces.
Some implementation updates were made to support ecosystem changes
and/or fix regressions.

3.27.2
------

* :ref:`Visual Studio Generators` for VS 14 (2015) and above now prefer to
select the latest Windows SDK, as documented by policy :policy:`CMP0149`,
when targeting any version of Windows. In CMake 3.27.[0-1] the
preference was limited to targeting Windows 10 and above.

* :ref:`Visual Studio Generators` for VS 14 (2015) and above now support
using ``version=8.1`` in the :variable:`CMAKE_GENERATOR_PLATFORM` variable
to select the Windows 8.1 SDK. In CMake 3.27.[0-1] the ``version=`` field
was limited to selecting Windows 10 SDKs.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY

.. versionadded:: 3.27

Whether to enable DEPENDS_EXPLICIT_ONLY option by default in
Whether to enable the ``DEPENDS_EXPLICIT_ONLY`` option by default in
:command:`add_custom_command`.

This variable affects the default behavior of the :command:`add_custom_command`
command. Setting this variable to ``ON`` is equivalent to using the ``DEPENDS_EXPLICIT_ONLY``
option in all uses of that command.
command. Setting this variable to ``ON`` is equivalent to using the
``DEPENDS_EXPLICIT_ONLY`` option in all uses of that command.

See also :variable:`CMAKE_OPTIMIZE_DEPENDENCIES`.
7 changes: 4 additions & 3 deletions Help/variable/CMAKE_ENABLE_EXPORTS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This variable is used to initialize the :prop_tgt:`ENABLE_EXPORTS` target
property for executable targets when they are created by calls to the
:command:`add_executable` command. See the property documentation for details.

This command has been superseded by the
:variable:`CMAKE_EXECUTABLE_ENABLE_EXPORTS` command. It is provided for
compatibility with older CMake code.
This variable has been superseded by the
:variable:`CMAKE_EXECUTABLE_ENABLE_EXPORTS` variable. It is provided for
backward compatibility with older CMake code, but should not be used in new
projects.
6 changes: 5 additions & 1 deletion Help/variable/CMAKE_GENERATOR_PLATFORM.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Supported pairs are:
.. versionadded:: 3.27

Specify the Windows SDK version to use. This is supported by VS 2015 and
above when targeting Windows 10.0+ or Windows Store. CMake will set the
above when targeting Windows or Windows Store. CMake will set the
:variable:`CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION` variable to the
selected SDK version.

Expand All @@ -66,6 +66,10 @@ Supported pairs are:
the value of :variable:`CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM`,
if that variable is set.

``8.1``
Specify the 8.1 SDK version. This is always supported by VS 2015.
On VS 2017 and above the 8.1 SDK must be installed.

If the ``version`` field is not specified, CMake selects a version as
described in the :variable:`CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION`
variable documentation.
17 changes: 17 additions & 0 deletions Modules/FindJNI.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,23 @@ foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}")
endforeach()

if(APPLE)
if(DEFINED XCODE_VERSION)
set(_FindJNI_XCODE_VERSION "${XCODE_VERSION}")
else()
# get xcode version
execute_process(
COMMAND xcodebuild -version
OUTPUT_VARIABLE _xcode_version
)
string(REGEX REPLACE "Xcode ([0-9]+(\\.[0-9]+)*)" "\\1" _FindJNI_XCODE_VERSION ${_xcode_version})
unset(_xcode_version)
endif()

if(_FindJNI_XCODE_VERSION VERSION_GREATER 12.1)
set(CMAKE_FIND_FRAMEWORK "NEVER")
endif()
unset(_FindJNI_XCODE_VERSION)

if(CMAKE_FIND_FRAMEWORK STREQUAL "ONLY")
set(_JNI_SEARCHES FRAMEWORK)
elseif(CMAKE_FIND_FRAMEWORK STREQUAL "NEVER")
Expand Down
2 changes: 1 addition & 1 deletion Modules/FindPython/Support.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2197,7 +2197,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)

# retrieve various package installation directories
execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
"import sys\ntry:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_path('stdlib'),sysconfig.get_path('platstdlib'),sysconfig.get_path('purelib'),sysconfig.get_path('platlib')]))\nexcept Exception:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_python_lib(plat_specific=False,standard_lib=True),sysconfig.get_python_lib(plat_specific=True,standard_lib=True),sysconfig.get_python_lib(plat_specific=False,standard_lib=False),sysconfig.get_python_lib(plat_specific=True,standard_lib=False)]))"
"import sys\nif sys.version_info >= (3,10):\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_path('stdlib'),sysconfig.get_path('platstdlib'),sysconfig.get_path('purelib'),sysconfig.get_path('platlib')]))\nelse:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_python_lib(plat_specific=False,standard_lib=True),sysconfig.get_python_lib(plat_specific=True,standard_lib=True),sysconfig.get_python_lib(plat_specific=False,standard_lib=False),sysconfig.get_python_lib(plat_specific=True,standard_lib=False)]))"
RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
OUTPUT_VARIABLE _${_PYTHON_PREFIX}_LIBPATHS
ERROR_QUIET)
Expand Down
10 changes: 3 additions & 7 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -938,13 +938,9 @@ if(WIN32 AND NOT CYGWIN)
list(APPEND _tools cmcldeps)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc")
# the atomic instructions are implemented using libatomic on some platforms,
# so linking to that may be required
check_library_exists(atomic __atomic_fetch_add_4 "" LIBATOMIC_NEEDED)
if(LIBATOMIC_NEEDED)
target_link_libraries(CMakeLib PUBLIC atomic)
endif()
# Some atomic instructions are implemented using libatomic on some platforms.
if(CMake_HAVE_CXX_ATOMIC_LIB)
target_link_libraries(CMakeLib PUBLIC atomic)
endif()

# On Apple we need CoreFoundation and CoreServices
Expand Down
2 changes: 1 addition & 1 deletion Source/CMakeVersion.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 27)
set(CMake_VERSION_PATCH 1)
set(CMake_VERSION_PATCH 2)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)

Expand Down
6 changes: 6 additions & 0 deletions Source/Checks/cm_cxx_atomic.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <atomic>
int main()
{
std::atomic<long long>(0).load();
return 0;
}
1 change: 1 addition & 0 deletions Source/Checks/cm_cxx_atomic_builtin.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "cm_cxx_atomic.cxx"
1 change: 1 addition & 0 deletions Source/Checks/cm_cxx_atomic_lib.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "cm_cxx_atomic.cxx"
11 changes: 11 additions & 0 deletions Source/Checks/cm_cxx_features.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function(cm_check_cxx_feature name)
try_run(CMake_RUN_CXX_${FEATURE} CMake_COMPILE_CXX_${FEATURE}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_LIST_DIR}/cm_cxx_${name}.cxx
LINK_LIBRARIES ${cm_check_cxx_feature_LINK_LIBRARIES}
CMAKE_FLAGS ${maybe_cxx_standard}
OUTPUT_VARIABLE OUTPUT
)
Expand All @@ -29,6 +30,7 @@ function(cm_check_cxx_feature name)
try_compile(CMake_HAVE_CXX_${FEATURE}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_LIST_DIR}/cm_cxx_${name}.cxx
LINK_LIBRARIES ${cm_check_cxx_feature_LINK_LIBRARIES}
CMAKE_FLAGS ${maybe_cxx_standard}
OUTPUT_VARIABLE OUTPUT
)
Expand Down Expand Up @@ -93,3 +95,12 @@ if (NOT CMAKE_CXX_STANDARD LESS "17")
else()
set(CMake_HAVE_CXX_FILESYSTEM FALSE)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "armv7l|sparc")
cm_check_cxx_feature(atomic_builtin)
if(NOT CMake_HAVE_CXX_ATOMIC_BUILTIN)
set(cm_check_cxx_feature_LINK_LIBRARIES atomic)
cm_check_cxx_feature(atomic_lib) # defines CMake_HAVE_CXX_ATOMIC_LIB
unset(cm_check_cxx_feature_LINK_LIBRARIES)
endif()
endif()
3 changes: 2 additions & 1 deletion Source/cmFileCommand.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2555,8 +2555,9 @@ bool HandleGenerateCommand(std::vector<std::string> const& args,
return false;
}
const bool inputIsContent = arguments.ParsedKeywords[1] == "CONTENT"_s;
if (!inputIsContent && arguments.ParsedKeywords[1] == "INPUT") {
if (!inputIsContent && arguments.ParsedKeywords[1] != "INPUT") {
status.SetError("Unknown argument to GENERATE subcommand.");
return false;
}
std::string const& input =
inputIsContent ? *arguments.Content : *arguments.Input;
Expand Down
2 changes: 1 addition & 1 deletion Source/cmGlobalVisualStudio10Generator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ bool cmGlobalVisualStudio10Generator::InitializePlatformWindows(cmMakefile*)
}

bool cmGlobalVisualStudio10Generator::VerifyNoGeneratorPlatformVersion(
cmMakefile*, cm::optional<std::string>) const
cmMakefile*) const
{
return true;
}
Expand Down
3 changes: 1 addition & 2 deletions Source/cmGlobalVisualStudio10Generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@ class cmGlobalVisualStudio10Generator : public cmGlobalVisualStudio8Generator

bool InitializePlatform(cmMakefile* mf) override;
virtual bool InitializePlatformWindows(cmMakefile* mf);
virtual bool VerifyNoGeneratorPlatformVersion(
cmMakefile* mf, cm::optional<std::string> reason = cm::nullopt) const;
virtual bool VerifyNoGeneratorPlatformVersion(cmMakefile* mf) const;

virtual bool ProcessGeneratorToolsetField(std::string const& key,
std::string const& value);
Expand Down
Loading

0 comments on commit e3f8130

Please sign in to comment.