summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/get_cmake_property.rst6
-rw-r--r--Help/command/get_source_file_property.rst14
-rw-r--r--Help/command/get_target_property.rst16
-rw-r--r--Help/command/get_test_property.rst14
-rw-r--r--Help/command/set_directory_properties.rst5
-rw-r--r--Help/command/set_target_properties.rst6
-rw-r--r--Help/command/set_tests_properties.rst5
-rw-r--r--Help/guide/tutorial/Adding Generator Expressions.rst2
-rw-r--r--Help/guide/tutorial/Adding a Library.rst8
-rw-r--r--Help/guide/tutorial/Step12/CMakeLists.txt2
-rw-r--r--Help/manual/cmake-cxxmodules.7.rst4
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst11
-rw-r--r--Help/manual/ctest.1.rst10
-rw-r--r--Help/policy/CMP0158.rst2
-rw-r--r--Help/prop_sf/SKIP_UNITY_BUILD_INCLUSION.rst4
-rw-r--r--Help/prop_tgt/UNITY_BUILD.rst5
-rw-r--r--Help/release/dev/ctest-cli-http-headers.rst5
-rw-r--r--Modules/CMakeSwiftInformation.cmake1
-rw-r--r--Modules/CheckLanguage.cmake28
-rw-r--r--Modules/Compiler/LCC-C.cmake27
-rw-r--r--Modules/Compiler/LCC-CXX.cmake32
-rw-r--r--Modules/FindCUDAToolkit.cmake5
-rw-r--r--Modules/FindCxxTest.cmake2
-rw-r--r--Modules/FindPkgConfig.cmake6
-rw-r--r--Modules/GetPrerequisites.cmake2
-rw-r--r--Modules/Internal/CPack/CPack.NuGet.nuspec.in2
-rw-r--r--Modules/Internal/CPack/CPackNuGet.cmake21
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx13
-rw-r--r--Source/CTest/cmCTestSubmitHandler.h14
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx5
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx2
-rw-r--r--Source/QtDialog/FirstConfigure.cxx4
-rw-r--r--Source/QtDialog/FirstConfigure.h1
-rw-r--r--Source/QtDialog/QCMake.cxx96
-rw-r--r--Source/QtDialog/QCMakeCacheView.h8
-rw-r--r--Source/cmComputeLinkInformation.cxx16
-rw-r--r--Source/cmComputeLinkInformation.h2
-rw-r--r--Source/cmExecuteProcessCommand.cxx6
-rw-r--r--Source/cmFindLibraryCommand.cxx8
-rw-r--r--Source/cmGeneratorTarget.cxx14
-rw-r--r--Source/cmGeneratorTarget.h3
-rw-r--r--Source/cmGlobalGenerator.cxx30
-rw-r--r--Source/cmGlobalGenerator.h1
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx8
-rw-r--r--Source/cmGlobalNinjaGenerator.h3
-rw-r--r--Source/cmLocalGenerator.cxx9
-rw-r--r--Source/cmMakefileTargetGenerator.cxx49
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx6
-rw-r--r--Source/cmNinjaTargetGenerator.cxx177
-rw-r--r--Source/cmNinjaTargetGenerator.h7
-rw-r--r--Source/cmPolicies.h2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx11
-rw-r--r--Source/ctest.cxx3
-rw-r--r--Tests/CMakeOnly/CMakeLists.txt7
-rw-r--r--Tests/CMakeOnly/CheckLanguageHIPPlatform/CMakeLists.txt17
-rw-r--r--Tests/CMakeOnly/CheckLanguageHIPPlatform2/CMakeLists.txt14
-rw-r--r--Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake11
-rw-r--r--Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/path with space/CMakeLists.txt9
-rw-r--r--Tests/RunCMake/CMakeLists.txt65
-rw-r--r--Tests/RunCMake/CXXModules/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CXXModules/examples/scan_properties/CMakeLists.txt8
-rw-r--r--Tests/RunCMake/CXXModules/examples/scan_properties/never_scan.ixx (renamed from Tests/RunCMake/CXXModules/examples/scan_properties/never_scan.cxx)0
-rw-r--r--Tests/RunCMake/CXXModules/examples/unity-build/CMakeLists.txt26
-rw-r--r--Tests/RunCMake/CXXModules/examples/unity-build/importable.cxx10
-rw-r--r--Tests/RunCMake/CXXModules/examples/unity-build/main.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/unity-build/unity.h7
-rw-r--r--Tests/RunCMake/CXXModules/examples/unity-build/unity1.cxx8
-rw-r--r--Tests/RunCMake/CXXModules/examples/unity-build/unity2.cxx10
-rw-r--r--Tests/RunCMake/CXXModules/examples/vs-without-flags/CMakeLists.txt22
-rw-r--r--Tests/RunCMake/CXXModules/examples/vs-without-flags/main.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/vs-without-flags/module.cxx6
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesFortran.cmake8
-rw-r--r--Tests/RunCMake/CheckSourceRuns/CheckSourceRunsFortran.cmake8
-rw-r--r--Tests/RunCMake/RuntimePath/RunCMakeTest.cmake41
-rw-r--r--Tests/RunCMake/RuntimePath/Stub-fail-result.txt1
-rw-r--r--Tests/RunCMake/RuntimePath/Stub-fail-stderr.txt1
-rw-r--r--Tests/RunCMake/RuntimePath/Stub.c4
-rw-r--r--Tests/RunCMake/RuntimePath/Stub.cmake25
-rw-r--r--Tests/RunCMake/RuntimePath/StubExe.c5
-rw-r--r--Tests/RunCMake/RuntimePath/StubUse.c5
-rw-r--r--Tests/RunCMake/Swift/CompileCommands-check.cmake30
-rw-r--r--Tests/RunCMake/Swift/CompileCommands.cmake9
-rw-r--r--Tests/RunCMake/Swift/ForceResponseFile-check-stdout.txt4
-rw-r--r--Tests/RunCMake/Swift/ForceResponseFile.cmake13
-rw-r--r--Tests/RunCMake/Swift/NoWorkToDo-norelink-stdout.txt2
-rw-r--r--Tests/RunCMake/Swift/NoWorkToDo.cmake7
-rw-r--r--Tests/RunCMake/Swift/RunCMakeTest.cmake21
-rw-r--r--Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout.txt3
-rw-r--r--Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake8
-rw-r--r--Tests/RunCMake/export/DependOnDoubleExport-stderr.txt4
-rwxr-xr-xUtilities/Scripts/update-zlib.bash2
-rw-r--r--Utilities/cmzlib/README4
-rw-r--r--Utilities/cmzlib/compress.c6
-rw-r--r--Utilities/cmzlib/crc32.c33
-rw-r--r--Utilities/cmzlib/deflate.c218
-rw-r--r--Utilities/cmzlib/deflate.h4
-rw-r--r--Utilities/cmzlib/gzlib.c2
-rw-r--r--Utilities/cmzlib/gzread.c8
-rw-r--r--Utilities/cmzlib/gzwrite.c2
-rw-r--r--Utilities/cmzlib/inflate.c7
-rw-r--r--Utilities/cmzlib/inftrees.c4
-rw-r--r--Utilities/cmzlib/inftrees.h2
-rw-r--r--Utilities/cmzlib/trees.c123
-rw-r--r--Utilities/cmzlib/uncompr.c4
-rw-r--r--Utilities/cmzlib/zconf.h19
-rw-r--r--Utilities/cmzlib/zlib.h20
-rw-r--r--Utilities/cmzlib/zutil.c16
-rw-r--r--Utilities/cmzlib/zutil.h1
110 files changed, 1201 insertions, 454 deletions
diff --git a/Help/command/get_cmake_property.rst b/Help/command/get_cmake_property.rst
index b1d18a0..9f78a86 100644
--- a/Help/command/get_cmake_property.rst
+++ b/Help/command/get_cmake_property.rst
@@ -5,11 +5,11 @@ Get a global property of the CMake instance.
.. code-block:: cmake
- get_cmake_property(<var> <property>)
+ get_cmake_property(<variable> <property>)
Gets a global property from the CMake instance. The value of
-the ``<property>`` is stored in the variable ``<var>``.
-If the property is not found, ``<var>`` will be set to ``NOTFOUND``.
+the ``<property>`` is stored in the specified ``<variable>``.
+If the property is not found, ``<variable>`` will be set to ``NOTFOUND``.
See the :manual:`cmake-properties(7)` manual for available properties.
In addition to global properties, this command (for historical reasons)
diff --git a/Help/command/get_source_file_property.rst b/Help/command/get_source_file_property.rst
index e83e9c2..a7e5191 100644
--- a/Help/command/get_source_file_property.rst
+++ b/Help/command/get_source_file_property.rst
@@ -9,14 +9,12 @@ Get a property for a source file.
[DIRECTORY <dir> | TARGET_DIRECTORY <target>]
<property>)
-Gets a property from a source file. The value of the property is
-stored in the specified ``<variable>``. If the source property is not found,
-the behavior depends on whether it has been defined to be an ``INHERITED``
-property or not (see :command:`define_property`). Non-inherited properties
-will set ``variable`` to ``NOTFOUND``, whereas inherited properties will search
-the relevant parent scope as described for the :command:`define_property`
-command and if still unable to find the property, ``variable`` will be set to
-an empty string.
+Gets a property from a source file. The value of the property is stored in
+the specified ``<variable>``. If the ``<file>`` is not a source file, or the
+source property is not found, ``<variable>`` will be set to ``NOTFOUND``.
+If the source property was defined to be an ``INHERITED`` property (see
+:command:`define_property`), the search will include the relevant parent
+scopes, as described for the :command:`define_property` command.
By default, the source file's property will be read from the current source
directory's scope.
diff --git a/Help/command/get_target_property.rst b/Help/command/get_target_property.rst
index 8c6dcb1..1554a85 100644
--- a/Help/command/get_target_property.rst
+++ b/Help/command/get_target_property.rst
@@ -5,16 +5,14 @@ Get a property from a target.
.. code-block:: cmake
- get_target_property(<VAR> target property)
+ get_target_property(<variable> <target> <property>)
-Get a property from a target. The value of the property is stored in
-the variable ``<VAR>``. If the target property is not found, the behavior
-depends on whether it has been defined to be an ``INHERITED`` property
-or not (see :command:`define_property`). Non-inherited properties will
-set ``<VAR>`` to ``<VAR>-NOTFOUND``, whereas inherited properties will search
-the relevant parent scope as described for the :command:`define_property`
-command and if still unable to find the property, ``<VAR>`` will be set to
-an empty string.
+Get a property from a target. The value of the property is stored in the
+specified ``<variable>``. If the target property is not found, ``<variable>``
+will be set to ``<variable>-NOTFOUND``. If the target property was defined to
+be an ``INHERITED`` property (see :command:`define_property`), the search will
+include the relevant parent scopes, as described for the
+:command:`define_property` command.
Use :command:`set_target_properties` to set target property values.
Properties are usually used to control how a target is built, but some
diff --git a/Help/command/get_test_property.rst b/Help/command/get_test_property.rst
index 1fcf24e..3f1a64c 100644
--- a/Help/command/get_test_property.rst
+++ b/Help/command/get_test_property.rst
@@ -5,16 +5,14 @@ Get a property of the test.
.. code-block:: cmake
- get_test_property(test property [DIRECTORY <dir>] VAR)
+ get_test_property(<test> <property> [DIRECTORY <dir>] <variable>)
Get a property from the test. The value of the property is stored in
-the variable ``VAR``. If the test property is not found, the behavior
-depends on whether it has been defined to be an ``INHERITED`` property
-or not (see :command:`define_property`). Non-inherited properties will
-set ``VAR`` to "NOTFOUND", whereas inherited properties will search the
-relevant parent scope as described for the :command:`define_property`
-command and if still unable to find the property, ``VAR`` will be set to
-an empty string.
+the specified ``<variable>``. If the ``<test>`` is not defined, or the
+test property is not found, ``<variable>`` will be set to ``NOTFOUND``.
+If the test property was defined to be an ``INHERITED`` property (see
+:command:`define_property`), the search will include the relevant parent
+scopes, as described for the :command:`define_property` command.
For a list of standard properties you can type
:option:`cmake --help-property-list`.
diff --git a/Help/command/set_directory_properties.rst b/Help/command/set_directory_properties.rst
index 93ad39b..6d94808 100644
--- a/Help/command/set_directory_properties.rst
+++ b/Help/command/set_directory_properties.rst
@@ -5,9 +5,10 @@ Set properties of the current directory and subdirectories.
.. code-block:: cmake
- set_directory_properties(PROPERTIES prop1 value1 [prop2 value2] ...)
+ set_directory_properties(PROPERTIES <prop1> <value1> [<prop2> <value2>] ...)
-Sets properties of the current directory and its subdirectories in key-value pairs.
+Sets properties of the current directory and its subdirectories in key-value
+pairs.
See also the :command:`set_property(DIRECTORY)` command.
diff --git a/Help/command/set_target_properties.rst b/Help/command/set_target_properties.rst
index 874788b..5357575 100644
--- a/Help/command/set_target_properties.rst
+++ b/Help/command/set_target_properties.rst
@@ -5,9 +5,9 @@ Targets can have properties that affect how they are built.
.. code-block:: cmake
- set_target_properties(target1 target2 ...
- PROPERTIES prop1 value1
- prop2 value2 ...)
+ set_target_properties(<targets> ...
+ PROPERTIES <prop1> <value1>
+ [<prop2> <value2>] ...)
Sets properties on targets. The syntax for the command is to list all
the targets you want to change, and then provide the values you want to
diff --git a/Help/command/set_tests_properties.rst b/Help/command/set_tests_properties.rst
index da750e3..a21f746 100644
--- a/Help/command/set_tests_properties.rst
+++ b/Help/command/set_tests_properties.rst
@@ -5,7 +5,10 @@ Set a property of the tests.
.. code-block:: cmake
- set_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2 value2)
+ set_tests_properties(<tests>...
+ [DIRECTORY <dir>]
+ PROPERTIES <prop1> <value1>
+ [<prop2> <value2>]...)
Sets a property for the tests. If the test is not found, CMake
will report an error.
diff --git a/Help/guide/tutorial/Adding Generator Expressions.rst b/Help/guide/tutorial/Adding Generator Expressions.rst
index 910eacb..d2dddf7 100644
--- a/Help/guide/tutorial/Adding Generator Expressions.rst
+++ b/Help/guide/tutorial/Adding Generator Expressions.rst
@@ -24,7 +24,7 @@ Logical, Informational, and Output expressions.
Logical expressions are used to create conditional output. The basic
expressions are the ``0`` and ``1`` expressions. A ``$<0:...>`` results in the
-empty string, and ``<1:...>`` results in the content of ``...``. They can also
+empty string, and ``$<1:...>`` results in the content of ``...``. They can also
be nested.
Exercise 1 - Adding Compiler Warning Flags with Generator Expressions
diff --git a/Help/guide/tutorial/Adding a Library.rst b/Help/guide/tutorial/Adding a Library.rst
index 18ced97..cfcfc67 100644
--- a/Help/guide/tutorial/Adding a Library.rst
+++ b/Help/guide/tutorial/Adding a Library.rst
@@ -145,10 +145,10 @@ Next, the new library target is linked to the executable target using
</details>
-Finally we need to specify the library's header file location. Modify
-:command:`target_include_directories` to add the ``MathFunctions`` subdirectory
-as an include directory so that the ``MathFunctions.h`` header file can be
-found.
+Finally we need to specify the library's header file location.
+Modify the existing :command:`target_include_directories` call
+to add the ``MathFunctions`` subdirectory as an include directory
+so that the ``MathFunctions.h`` header file can be found.
.. raw:: html
diff --git a/Help/guide/tutorial/Step12/CMakeLists.txt b/Help/guide/tutorial/Step12/CMakeLists.txt
index 1d8b5a6..1ba4e31 100644
--- a/Help/guide/tutorial/Step12/CMakeLists.txt
+++ b/Help/guide/tutorial/Step12/CMakeLists.txt
@@ -97,7 +97,7 @@ include(CMakePackageConfigHelpers)
# generate the config file that includes the exports
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake"
- INSTALL_DESTINATION "lib/cmake/example"
+ INSTALL_DESTINATION "lib/cmake/MathFunctions"
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
diff --git a/Help/manual/cmake-cxxmodules.7.rst b/Help/manual/cmake-cxxmodules.7.rst
index b4c9cf1..3ee6645 100644
--- a/Help/manual/cmake-cxxmodules.7.rst
+++ b/Help/manual/cmake-cxxmodules.7.rst
@@ -30,6 +30,10 @@ following queries. The first query that provides a yes/no answer is used.
- Otherwise, the source file will be scanned if the compiler and generator
support scanning. See policy :policy:`CMP0155`.
+Note that any scanned source will be excluded from any unity build (see
+:prop_tgt:`UNITY_BUILD`) because module-related statements can only happen at
+one place within a C++ translation unit.
+
Compiler Support
================
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 3e58b31..a0b5b66 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -2333,10 +2333,13 @@ Export And Install Expressions
Content of the install prefix when the target is exported via
:command:`install(EXPORT)`, or when evaluated in the
- :prop_tgt:`INSTALL_NAME_DIR` property, the ``INSTALL_NAME_DIR`` argument of
- :command:`install(RUNTIME_DEPENDENCY_SET)`, the code argument of
- :command:`install(CODE)`, or the file argument of :command:`install(SCRIPT)`,
- and empty otherwise.
+ :prop_tgt:`INSTALL_NAME_DIR` property or the ``INSTALL_NAME_DIR`` argument of
+ :command:`install(RUNTIME_DEPENDENCY_SET)`, and empty otherwise.
+
+ .. versionchanged:: 3.27
+ Evaluates to the content of the install prefix
+ in the code argument of :command:`install(CODE)` or
+ the file argument of :command:`install(SCRIPT)`.
Multi-level Expression Evaluation
---------------------------------
diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst
index 0917191..1924d4f 100644
--- a/Help/manual/ctest.1.rst
+++ b/Help/manual/ctest.1.rst
@@ -754,6 +754,16 @@ The available ``<dashboard-options>`` are the following:
This option will submit extra files to the dashboard.
+.. option:: --http-header <header>
+
+ .. versionadded:: 3.29
+
+ Append HTTP header when submitting to the dashboard.
+
+ This option will cause CTest to append the specified header
+ when submitting to the dashboard.
+ This option may be specified more than once.
+
.. option:: --http1.0
Submit using `HTTP 1.0`.
diff --git a/Help/policy/CMP0158.rst b/Help/policy/CMP0158.rst
index 4289c6d..369b5ec 100644
--- a/Help/policy/CMP0158.rst
+++ b/Help/policy/CMP0158.rst
@@ -25,3 +25,5 @@ This policy was introduced in CMake version 3.29. Use the
:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
Unlike many policies, CMake version |release| does *not* warn
when this policy is not set and simply uses ``OLD`` behavior.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/prop_sf/SKIP_UNITY_BUILD_INCLUSION.rst b/Help/prop_sf/SKIP_UNITY_BUILD_INCLUSION.rst
index ae526ac..38a0a78 100644
--- a/Help/prop_sf/SKIP_UNITY_BUILD_INCLUSION.rst
+++ b/Help/prop_sf/SKIP_UNITY_BUILD_INCLUSION.rst
@@ -11,3 +11,7 @@ in the same way as it would with unity builds disabled.
This property helps with "ODR (One definition rule)" problems where combining
a particular source file with others might lead to build errors or other
unintended side effects.
+
+Note that sources which are scanned for C++ modules (see
+:manual:`cmake-cxxmodules(7)`) are not eligible for unity build inclusion and
+will automatically be excluded.
diff --git a/Help/prop_tgt/UNITY_BUILD.rst b/Help/prop_tgt/UNITY_BUILD.rst
index 52f4714..577b0c9 100644
--- a/Help/prop_tgt/UNITY_BUILD.rst
+++ b/Help/prop_tgt/UNITY_BUILD.rst
@@ -76,6 +76,11 @@ a number of measures to help address such problems:
:prop_sf:`INCLUDE_DIRECTORIES` source property will not be combined
into a unity source.
+* Any source file which is scanned for C++ module sources via
+ :prop_tgt:`CXX_SCAN_FOR_MODULES`, :prop_sf:`CXX_SCAN_FOR_MODULES`, or
+ membership of a ``CXX_MODULES`` file set will not be combined into a unity
+ source. See :manual:`cmake-cxxmodules(7)` for details.
+
* Projects can prevent an individual source file from being combined into
a unity source by setting its :prop_sf:`SKIP_UNITY_BUILD_INCLUSION`
source property to true. This can be a more effective way to prevent
diff --git a/Help/release/dev/ctest-cli-http-headers.rst b/Help/release/dev/ctest-cli-http-headers.rst
new file mode 100644
index 0000000..81d4c7b
--- /dev/null
+++ b/Help/release/dev/ctest-cli-http-headers.rst
@@ -0,0 +1,5 @@
+ctest-cli-http-headers
+----------------------
+
+* :manual:`ctest(1)` gained a :option:`--http-header <ctest --http-header>`
+ option to add custom headers on submission to CDash.
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake
index 04d500e..7a1c64a 100644
--- a/Modules/CMakeSwiftInformation.cmake
+++ b/Modules/CMakeSwiftInformation.cmake
@@ -56,6 +56,7 @@ set(CMAKE_Swift_LIBRARY_PATH_TERMINATOR "")
set(CMAKE_Swift_LINK_LIBRARY_FLAG "-l")
set(CMAKE_Swift_LINKER_WRAPPER_FLAG "-Xlinker" " ")
set(CMAKE_Swift_RESPONSE_FILE_LINK_FLAG @)
+set(CMAKE_Swift_RESPONSE_FILE_FLAG @)
set(CMAKE_Swift_LINKER_PREFERENCE 50)
set(CMAKE_Swift_LINKER_PREFERENCE_PROPAGATES 1)
diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake
index 94948b9..bad3590 100644
--- a/Modules/CheckLanguage.cmake
+++ b/Modules/CheckLanguage.cmake
@@ -41,6 +41,12 @@ or :command:`project` commands:
not be set without also setting
:variable:`CMAKE_<LANG>_COMPILER` to a NVCC compiler.
+ :variable:`CMAKE_<LANG>_PLATFORM <CMAKE_HIP_PLATFORM>`
+ This variable is set to the detected GPU platform when ``<lang>`` is ``HIP``.
+
+ If the variable is already set its value is always preserved. Only compatible values
+ will be considered for :variable:`CMAKE_<LANG>_COMPILER`.
+
For example:
.. code-block:: cmake
@@ -66,15 +72,23 @@ macro(check_language lang)
set(extra_compiler_variables)
if("${lang}" MATCHES "^(CUDA|HIP)$" AND NOT CMAKE_GENERATOR MATCHES "Visual Studio")
- set(extra_compiler_variables "set(CMAKE_CUDA_HOST_COMPILER \\\"\${CMAKE_CUDA_HOST_COMPILER}\\\")")
+ set(extra_compiler_variables "set(CMAKE_${lang}_HOST_COMPILER \\\"\${CMAKE_${lang}_HOST_COMPILER}\\\")")
+ endif()
+
+ if("${lang}" STREQUAL "HIP")
+ list(APPEND extra_compiler_variables "set(CMAKE_${lang}_PLATFORM \\\"\${CMAKE_${lang}_PLATFORM}\\\")")
endif()
+ list(TRANSFORM extra_compiler_variables PREPEND "\"")
+ list(TRANSFORM extra_compiler_variables APPEND "\\n\"")
+ list(JOIN extra_compiler_variables "\n " extra_compiler_variables)
+
set(_cl_content
"cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(Check${lang} ${lang})
file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
\"set(CMAKE_${lang}_COMPILER \\\"\${CMAKE_${lang}_COMPILER}\\\")\\n\"
- \"${extra_compiler_variables}\\n\"
+ ${extra_compiler_variables}
)"
)
@@ -95,6 +109,11 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
else()
set(_D_CMAKE_TOOLCHAIN_FILE "")
endif()
+ if(CMAKE_${lang}_PLATFORM)
+ set(_D_CMAKE_LANG_PLATFORM "-DCMAKE_${lang}_PLATFORM:STRING=${CMAKE_${lang}_PLATFORM}")
+ else()
+ set(_D_CMAKE_LANG_PLATFORM "")
+ endif()
execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}
COMMAND ${CMAKE_COMMAND} . -G ${CMAKE_GENERATOR}
@@ -103,6 +122,7 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
${_D_CMAKE_GENERATOR_INSTANCE}
${_D_CMAKE_MAKE_PROGRAM}
${_D_CMAKE_TOOLCHAIN_FILE}
+ ${_D_CMAKE_LANG_PLATFORM}
OUTPUT_VARIABLE _cl_output
ERROR_VARIABLE _cl_output
RESULT_VARIABLE _cl_result
@@ -130,6 +150,10 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
mark_as_advanced(CMAKE_${lang}_HOST_COMPILER)
endif()
+ if(CMAKE_${lang}_PLATFORM)
+ set(CMAKE_${lang}_PLATFORM "${CMAKE_${lang}_PLATFORM}" CACHE STRING "${lang} platform")
+ mark_as_advanced(CMAKE_${lang}_PLATFORM)
+ endif()
endif()
endmacro()
diff --git a/Modules/Compiler/LCC-C.cmake b/Modules/Compiler/LCC-C.cmake
index 3dd6e68..99f791f 100644
--- a/Modules/Compiler/LCC-C.cmake
+++ b/Modules/Compiler/LCC-C.cmake
@@ -12,18 +12,25 @@ endif()
set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
-set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
-set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
-set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
+if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 1.23)
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
+ set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
+endif()
+
set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
-set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
-set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
-set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
-set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
-set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
-set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x")
-set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
+
+if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 1.20)
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+ set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+endif()
+
+if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 1.26)
+ set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
+ set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
+endif()
__compiler_check_default_language_standard(C 1.23 90 1.20 11 1.26 17)
diff --git a/Modules/Compiler/LCC-CXX.cmake b/Modules/Compiler/LCC-CXX.cmake
index b3bdd3c..385947a 100644
--- a/Modules/Compiler/LCC-CXX.cmake
+++ b/Modules/Compiler/LCC-CXX.cmake
@@ -17,15 +17,27 @@ set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hi
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
-set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
-set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
-set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
-set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
-set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
-set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
-set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
-set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
-set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++2a")
-set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
+
+if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 1.20)
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
+ set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
+endif()
+
+if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 1.21)
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
+ set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
+endif()
+
+if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 1.24)
+ set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
+ set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
+endif()
+
+if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 1.26)
+ set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++2a")
+ set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
+endif()
__compiler_check_default_language_standard(CXX 1.19 98 1.20 11 1.21 14 1.24 17 1.26 20)
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index 469a7ad..ac72c17 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -1100,7 +1100,10 @@ if(CUDAToolkit_FOUND)
if(CUDA_${lib_name}_LIBRARY MATCHES "/stubs/" AND NOT WIN32)
# Use a SHARED library with IMPORTED_IMPLIB, but not IMPORTED_LOCATION,
# to indicate that the stub is for linkers but not dynamic loaders.
- # It will not contribute any RPATH entry.
+ # It will not contribute any RPATH entry. When encountered as
+ # a private transitive dependency of another shared library,
+ # it will be passed explicitly to linkers so they can find it
+ # even when the runtime library file does not exist on disk.
set(CUDA_IMPORT_PROPERTY IMPORTED_IMPLIB)
set(CUDA_IMPORT_TYPE SHARED)
endif()
diff --git a/Modules/FindCxxTest.cmake b/Modules/FindCxxTest.cmake
index 714927f..a3283fa 100644
--- a/Modules/FindCxxTest.cmake
+++ b/Modules/FindCxxTest.cmake
@@ -10,7 +10,7 @@ Find CxxTest unit testing framework.
Find the `CxxTest`_ suite and declare a helper macro for creating
unit tests and integrating them with CTest.
-.. _`CxxTest`: https://github.com/CxxTest/cxxtest#readme
+.. _`CxxTest`: https://github.com/CxxTest/cxxtest
Input Variables
^^^^^^^^^^^^^^^
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 27d25fb..1b6a72a 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -656,6 +656,9 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
if (APPLE AND "-framework" IN_LIST ${_prefix}_LDFLAGS_OTHER)
_pkgconfig_extract_frameworks("${_prefix}")
+ # Using _pkgconfig_set in this scope so that a future policy can switch to normal variables
+ _pkgconfig_set("${_pkg_check_prefix}_LIBRARIES" "${${_pkg_check_prefix}_LIBRARIES}")
+ _pkgconfig_set("${_pkg_check_prefix}_LDFLAGS_OTHER" "${${_pkg_check_prefix}_LDFLAGS_OTHER}")
endif()
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )(-I|-isystem ?)" --cflags-only-I )
@@ -664,6 +667,9 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
if (${_prefix}_CFLAGS_OTHER MATCHES "-isystem")
_pkgconfig_extract_isystem("${_prefix}")
+ # Using _pkgconfig_set in this scope so that a future policy can switch to normal variables
+ _pkgconfig_set("${_pkg_check_prefix}_CFLAGS_OTHER" "${${_pkg_check_prefix}_CFLAGS_OTHER}")
+ _pkgconfig_set("${_pkg_check_prefix}_INCLUDE_DIRS" "${${_pkg_check_prefix}_INCLUDE_DIRS}")
endif ()
_pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} ${_imp_target_global})
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index 0ba35b6..d55c4ca 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -514,7 +514,7 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
string(TOLOWER "${resolved_file}" lower)
if(UNIX)
- if(resolved_file MATCHES "^(/lib/|/lib32/|/libx32/|/lib64/|/usr/lib/|/usr/lib32/|/usr/libx32/|/usr/lib64/|/usr/X11R6/|/usr/bin/)")
+ if(resolved_file MATCHES "^/*(/lib/|/lib32/|/libx32/|/lib64/|/usr/lib/|/usr/lib32/|/usr/libx32/|/usr/lib64/|/usr/X11R6/|/usr/bin/)")
set(is_system 1)
endif()
endif()
diff --git a/Modules/Internal/CPack/CPack.NuGet.nuspec.in b/Modules/Internal/CPack/CPack.NuGet.nuspec.in
index d89d69f..4548a59 100644
--- a/Modules/Internal/CPack/CPack.NuGet.nuspec.in
+++ b/Modules/Internal/CPack/CPack.NuGet.nuspec.in
@@ -15,12 +15,14 @@
@_CPACK_NUGET_LICENSE_TAG@
@_CPACK_NUGET_ICONURL_TAG@
@_CPACK_NUGET_ICON_TAG@
+ @_CPACK_NUGET_README_TAG@
@_CPACK_NUGET_REQUIRELICENSEACCEPTANCE_TAG@
@_CPACK_NUGET_SUMMARY_TAG@
@_CPACK_NUGET_RELEASENOTES_TAG@
@_CPACK_NUGET_COPYRIGHT_TAG@
@_CPACK_NUGET_LANGUAGE_TAG@
@_CPACK_NUGET_TAGS_TAG@
+ @_CPACK_NUGET_REPOSITORY_TAG@
@_CPACK_NUGET_DEPENDENCIES_TAG@
</metadata>
@_CPACK_NUGET_FILES_TAG@
diff --git a/Modules/Internal/CPack/CPackNuGet.cmake b/Modules/Internal/CPack/CPackNuGet.cmake
index 056d025..67f318a 100644
--- a/Modules/Internal/CPack/CPackNuGet.cmake
+++ b/Modules/Internal/CPack/CPackNuGet.cmake
@@ -294,6 +294,27 @@ function(_cpack_nuget_render_spec)
# attributes: "type", "url", "branch", and "commit". While all fields are
# considered optional, they are not independent. Currently unsupported.
+ # NuGet >= 5.10
+ _cpack_nuget_variable_fallback_and_wrap_into_element(readme README)
+
+ set(_CPACK_NUGET_REPOSITORY_TAG)
+ _cpack_nuget_variable_fallback(_repo_type REPOSITORY_TYPE)
+ _cpack_nuget_variable_fallback(_repo_url REPOSITORY_URL)
+ if(_repo_type AND _repo_url)
+ set(_CPACK_NUGET_REPOSITORY_TAG "<repository type=\"${_repo_type}\" url=\"${_repo_url}\"")
+ _cpack_nuget_variable_fallback(_repo_br REPOSITORY_BRANCH)
+ if(_repo_br)
+ string(APPEND _CPACK_NUGET_REPOSITORY_TAG " branch=\"${_repo_br}\"")
+ endif()
+ _cpack_nuget_variable_fallback(_repo_commit REPOSITORY_COMMIT)
+ if(_repo_commit)
+ string(APPEND _CPACK_NUGET_REPOSITORY_TAG " commit=\"${_repo_commit}\"")
+ endif()
+ string(APPEND _CPACK_NUGET_REPOSITORY_TAG " />")
+ else()
+ message(AUTHOR_WARNING "Skip adding the `<repository .../>` element due to missing URL or type")
+ endif()
+
# Handle dependencies
_cpack_nuget_variable_fallback(_deps DEPENDENCIES)
set(_collected_deps)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index eda95c1..6c8cc9a 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 28)
-set(CMake_VERSION_PATCH 20240104)
+set(CMake_VERSION_PATCH 20240111)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 77af889..db8a054 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -138,6 +138,19 @@ void cmCTestSubmitHandler::Initialize()
this->Files.clear();
}
+int cmCTestSubmitHandler::ProcessCommandLineArguments(
+ const std::string& currentArg, size_t& idx,
+ const std::vector<std::string>& allArgs)
+{
+ if (cmHasLiteralPrefix(currentArg, "--http-header") &&
+ idx < allArgs.size() - 1) {
+ ++idx;
+ this->HttpHeaders.push_back(allArgs[idx]);
+ this->CommandLineHttpHeaders.push_back(allArgs[idx]);
+ }
+ return 1;
+}
+
bool cmCTestSubmitHandler::SubmitUsingHTTP(
const std::string& localprefix, const std::vector<std::string>& files,
const std::string& remoteprefix, const std::string& url)
diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h
index 0c7253c..e8eb38a 100644
--- a/Source/CTest/cmCTestSubmitHandler.h
+++ b/Source/CTest/cmCTestSubmitHandler.h
@@ -4,6 +4,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <cstddef>
#include <iosfwd>
#include <set>
#include <string>
@@ -33,6 +34,11 @@ public:
void Initialize() override;
+ //! Set all the submit arguments
+ int ProcessCommandLineArguments(
+ const std::string& currentArg, size_t& idx,
+ const std::vector<std::string>& allArgs) override;
+
/** Specify a set of parts (by name) to submit. */
void SelectParts(std::set<cmCTest::Part> const& parts);
@@ -44,7 +50,12 @@ public:
void SetHttpHeaders(std::vector<std::string> const& v)
{
- this->HttpHeaders = v;
+ if (this->CommandLineHttpHeaders.empty()) {
+ this->HttpHeaders = v;
+ } else {
+ this->HttpHeaders = this->CommandLineHttpHeaders;
+ this->HttpHeaders.insert(this->HttpHeaders.end(), v.begin(), v.end());
+ }
}
private:
@@ -75,5 +86,6 @@ private:
bool HasWarnings;
bool HasErrors;
std::set<std::string> Files;
+ std::vector<std::string> CommandLineHttpHeaders;
std::vector<std::string> HttpHeaders;
};
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 77a0048..72460f3 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -962,6 +962,11 @@ int cmCursesMainForm::LoadCache(const char* /*unused*/)
if (r < 0) {
return r;
}
+
+ // Process presets before loading the cache
+ this->CMakeInstance->ProcessPresetVariables();
+ this->CMakeInstance->ProcessPresetEnvironment();
+
this->CMakeInstance->SetCacheArgs(this->Args);
this->CMakeInstance->PreLoadCMakeFiles();
return r;
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index ab77818..2a6a831 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -875,7 +875,7 @@ bool CMakeSetupDialog::setupFirstConfigure()
if (preset.setToolset) {
dialog.setToolset(preset.toolset);
}
- dialog.setCompilerOption(CompilerOption::DefaultNative);
+ dialog.setCompilerOption(CompilerOption::DefaultPreset);
}
if (dialog.exec() == QDialog::Accepted) {
diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx
index a454cb6..2986e1f 100644
--- a/Source/QtDialog/FirstConfigure.cxx
+++ b/Source/QtDialog/FirstConfigure.cxx
@@ -159,6 +159,10 @@ void StartCompilerSetup::setCompilerOption(CompilerOption option)
{
std::size_t index = 0;
switch (option) {
+ case CompilerOption::DefaultPreset:
+ this->CompilerSetupOptions[0]->setText(
+ tr("Use default preset compilers"));
+ CM_FALLTHROUGH;
case CompilerOption::DefaultNative:
index = 0;
break;
diff --git a/Source/QtDialog/FirstConfigure.h b/Source/QtDialog/FirstConfigure.h
index 5844f3a..ea6fae6 100644
--- a/Source/QtDialog/FirstConfigure.h
+++ b/Source/QtDialog/FirstConfigure.h
@@ -24,6 +24,7 @@ enum FirstConfigurePages
enum class CompilerOption
{
+ DefaultPreset,
DefaultNative,
SpecifyNative,
ToolchainFile,
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index f43f05f..8d63f6d 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -378,6 +378,54 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
this->CMakeInstance->SaveCache(this->BinaryDirectory.toStdString());
}
+namespace {
+template <typename T>
+QCMakeProperty cache_to_property(const T& v)
+{
+ QCMakeProperty prop;
+ prop.Key = QString::fromStdString(v.first);
+ prop.Value = QString::fromStdString(v.second->Value);
+ prop.Type = QCMakeProperty::STRING;
+ if (!v.second->Type.empty()) {
+ auto type = cmState::StringToCacheEntryType(v.second->Type);
+ switch (type) {
+ case cmStateEnums::BOOL:
+ prop.Type = QCMakeProperty::BOOL;
+ prop.Value = cmIsOn(v.second->Value);
+ break;
+ case cmStateEnums::PATH:
+ prop.Type = QCMakeProperty::PATH;
+ break;
+ case cmStateEnums::FILEPATH:
+ prop.Type = QCMakeProperty::FILEPATH;
+ break;
+ default:
+ prop.Type = QCMakeProperty::STRING;
+ break;
+ }
+ }
+ return prop;
+}
+
+void add_to_property_list(QCMakePropertyList& list, QCMakeProperty&& prop)
+{
+ // QCMakeCacheModel prefers variables earlier in the list rather than
+ // later, so overwrite them if they already exist rather than simply
+ // appending
+ bool found = false;
+ for (auto& orig : list) {
+ if (orig.Key == prop.Key) {
+ orig = prop;
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ list.append(prop);
+ }
+}
+}
+
QCMakePropertyList QCMake::properties() const
{
QCMakePropertyList ret;
@@ -423,47 +471,21 @@ QCMakePropertyList QCMake::properties() const
auto const& p =
this->CMakePresetsGraph.ConfigurePresets.at(presetName).Expanded;
if (p) {
+ if (!p->ToolchainFile.empty()) {
+ using CacheVariable = cmCMakePresetsGraph::CacheVariable;
+ CacheVariable var{ "FILEPATH", p->ToolchainFile };
+ std::pair<std::string, cm::optional<CacheVariable>> value = {
+ "CMAKE_TOOLCHAIN_FILE", var
+ };
+ auto prop = cache_to_property(value);
+ add_to_property_list(ret, std::move(prop));
+ }
for (auto const& v : p->CacheVariables) {
if (!v.second) {
continue;
}
- QCMakeProperty prop;
- prop.Key = QString::fromStdString(v.first);
- prop.Value = QString::fromStdString(v.second->Value);
- prop.Type = QCMakeProperty::STRING;
- if (!v.second->Type.empty()) {
- auto type = cmState::StringToCacheEntryType(v.second->Type);
- switch (type) {
- case cmStateEnums::BOOL:
- prop.Type = QCMakeProperty::BOOL;
- prop.Value = cmIsOn(v.second->Value);
- break;
- case cmStateEnums::PATH:
- prop.Type = QCMakeProperty::PATH;
- break;
- case cmStateEnums::FILEPATH:
- prop.Type = QCMakeProperty::FILEPATH;
- break;
- default:
- prop.Type = QCMakeProperty::STRING;
- break;
- }
- }
-
- // QCMakeCacheModel prefers variables earlier in the list rather than
- // later, so overwrite them if they already exist rather than simply
- // appending
- bool found = false;
- for (auto& orig : ret) {
- if (orig.Key == prop.Key) {
- orig = prop;
- found = true;
- break;
- }
- }
- if (!found) {
- ret.append(prop);
- }
+ auto prop = cache_to_property(v);
+ add_to_property_list(ret, std::move(prop));
}
}
}
diff --git a/Source/QtDialog/QCMakeCacheView.h b/Source/QtDialog/QCMakeCacheView.h
index 89068ab..549cca2 100644
--- a/Source/QtDialog/QCMakeCacheView.h
+++ b/Source/QtDialog/QCMakeCacheView.h
@@ -91,10 +91,6 @@ public slots:
const QString& description, const QVariant& value,
bool advanced);
- // set the view type
- void setViewType(ViewType t);
- ViewType viewType() const;
-
public:
// get the properties
QCMakePropertyList properties() const;
@@ -112,6 +108,10 @@ public:
// get the data in the model for this property
void getPropertyData(const QModelIndex& idx1, QCMakeProperty& prop) const;
+ // set the view type
+ void setViewType(ViewType t);
+ ViewType viewType() const;
+
protected:
bool EditEnabled;
int NewPropertyCount;
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 1b69f6e..40eb902 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -260,7 +260,7 @@ cmComputeLinkInformation::cmComputeLinkInformation(
, Config(config)
{
// Check whether to recognize OpenBSD-style library versioned names.
- this->OpenBSD = this->Makefile->GetState()->GetGlobalPropertyAsBool(
+ this->IsOpenBSD = this->Makefile->GetState()->GetGlobalPropertyAsBool(
"FIND_LIBRARY_USE_OPENBSD_VERSIONING");
// Allocate internals.
@@ -1331,7 +1331,17 @@ void cmComputeLinkInformation::AddSharedDepItem(LinkEntry const& entry)
}
// If in linking mode, just link to the shared library.
- if (this->SharedDependencyMode == SharedDepModeLink) {
+ if (this->SharedDependencyMode == SharedDepModeLink ||
+ // For an imported shared library without a known runtime artifact,
+ // such as a CUDA stub, a library file named with the real soname
+ // may not be available at all, so '-rpath-link' cannot help linkers
+ // find it to satisfy '--no-allow-shlib-undefined' recursively.
+ // Pass this dependency to the linker explicitly just in case.
+ // If the linker also uses '--as-needed' behavior, this will not
+ // add an unnecessary direct dependency.
+ (tgt && tgt->IsImported() &&
+ !tgt->HasKnownRuntimeArtifactLocation(this->Config) &&
+ this->Target->LinkerEnforcesNoAllowShLibUndefined(this->Config))) {
this->AddItem(entry);
return;
}
@@ -1574,7 +1584,7 @@ std::string cmComputeLinkInformation::CreateExtensionRegex(
libext += ')';
// Add an optional OpenBSD-style version or major.minor.version component.
- if (this->OpenBSD || type == LinkShared) {
+ if (this->IsOpenBSD || type == LinkShared) {
libext += "(\\.[0-9]+)*";
}
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 3ee995f..2a06530 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -254,7 +254,7 @@ private:
std::unique_ptr<cmOrderDirectories> OrderRuntimeSearchPath;
bool OldLinkDirMode;
- bool OpenBSD;
+ bool IsOpenBSD;
bool LinkDependsNoShared;
bool RuntimeUseChrpath;
bool NoSONameUsesPath;
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index e764545..483a601 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -35,7 +35,11 @@
namespace {
bool cmExecuteProcessCommandIsWhitespace(char c)
{
- return (isspace(static_cast<int>(c)) || c == '\n' || c == '\r');
+ // isspace takes 'int' but documents that the value must be representable
+ // by 'unsigned char', or EOF. Cast to 'unsigned char' to avoid sign
+ // extension while casting to 'int'.
+ return (isspace(static_cast<int>(static_cast<unsigned char>(c))) ||
+ c == '\n' || c == '\r');
}
void cmExecuteProcessCommandFixText(std::vector<char>& output,
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index df77ad0..9df7665 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -207,7 +207,7 @@ struct cmFindLibraryHelper
std::string BestPath;
// Support for OpenBSD shared library naming: lib<name>.so.<major>.<minor>
- bool OpenBSD;
+ bool IsOpenBSD;
bool DebugMode;
@@ -320,7 +320,7 @@ cmFindLibraryHelper::cmFindLibraryHelper(std::string debugName, cmMakefile* mf,
this->RegexFromList(this->SuffixRegexStr, this->Suffixes);
// Check whether to use OpenBSD-style library version comparisons.
- this->OpenBSD = this->Makefile->GetState()->GetGlobalPropertyAsBool(
+ this->IsOpenBSD = this->Makefile->GetState()->GetGlobalPropertyAsBool(
"FIND_LIBRARY_USE_OPENBSD_VERSIONING");
}
@@ -390,7 +390,7 @@ void cmFindLibraryHelper::AddName(std::string const& name)
std::string regex = cmStrCat('^', this->PrefixRegexStr);
this->RegexFromLiteral(regex, name);
regex += this->SuffixRegexStr;
- if (this->OpenBSD) {
+ if (this->IsOpenBSD) {
regex += "(\\.[0-9]+\\.[0-9]+)?";
}
regex += "$";
@@ -472,7 +472,7 @@ bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path,
size_type suffix = this->GetSuffixIndex(name.Regex.match(2));
unsigned int major = 0;
unsigned int minor = 0;
- if (this->OpenBSD) {
+ if (this->IsOpenBSD) {
sscanf(name.Regex.match(3).c_str(), ".%u.%u", &major, &minor);
}
if (this->BestPath.empty() || prefix < bestPrefix ||
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 289bb24..11253db 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -5596,6 +5596,20 @@ std::string cmGeneratorTarget::GetLinkerTool(const std::string& lang,
return linkerTool;
}
+bool cmGeneratorTarget::LinkerEnforcesNoAllowShLibUndefined(
+ std::string const& config) const
+{
+ // FIXME(#25486): Account for the LINKER_TYPE target property.
+ // Also factor out the hard-coded list below into a platform
+ // information table based on the linker id.
+ std::string ll = this->GetLinkerLanguage(config);
+ std::string linkerIdVar = cmStrCat("CMAKE_", ll, "_COMPILER_LINKER_ID");
+ cmValue linkerId = this->Makefile->GetDefinition(linkerIdVar);
+ // The GNU bfd-based linker may enforce '--no-allow-shlib-undefined'
+ // recursively by default. The Solaris linker has similar behavior.
+ return linkerId && (*linkerId == "GNU" || *linkerId == "Solaris");
+}
+
std::string cmGeneratorTarget::GetPDBOutputName(
const std::string& config) const
{
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index cfb08fa..fb56a0d 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -805,6 +805,9 @@ public:
std::string GetLinkerTool(const std::string& lang,
const std::string& config) const;
+ /** Is the linker known to enforce '--no-allow-shlib-undefined'? */
+ bool LinkerEnforcesNoAllowShLibUndefined(std::string const& config) const;
+
/** Does this target have a GNU implib to convert to MS format? */
bool HasImplibGNUtoMS(std::string const& config) const;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index e74a8b0..8a07073 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1612,6 +1612,13 @@ bool cmGlobalGenerator::Compute()
}
}
+ // Add unity sources after computing compile features. Unity sources do
+ // not change the set of languages or features, but we need to know them
+ // to filter out sources that are scanned for C++ module dependencies.
+ if (!this->AddUnitySources()) {
+ return false;
+ }
+
for (const auto& localGen : this->LocalGenerators) {
cmMakefile* mf = localGen->GetMakefile();
for (const auto& g : mf->GetInstallGenerators()) {
@@ -1888,7 +1895,6 @@ bool cmGlobalGenerator::AddAutomaticSources()
if (!gt->CanCompileSources()) {
continue;
}
- lg->AddUnityBuild(gt.get());
lg->AddISPCDependencies(gt.get());
// Targets that reuse a PCH are handled below.
if (!gt->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM")) {
@@ -1920,6 +1926,28 @@ bool cmGlobalGenerator::AddAutomaticSources()
return true;
}
+bool cmGlobalGenerator::AddUnitySources()
+{
+ for (const auto& lg : this->LocalGenerators) {
+ for (const auto& gt : lg->GetGeneratorTargets()) {
+ if (!gt->CanCompileSources()) {
+ continue;
+ }
+ lg->AddUnityBuild(gt.get());
+ }
+ }
+ // The above transformation may have changed the classification of sources.
+ // Clear the source list and classification cache (KindedSources) of all
+ // targets so that it will be recomputed correctly by the generators later
+ // now that the above transformations are done for all targets.
+ for (const auto& lg : this->LocalGenerators) {
+ for (const auto& gt : lg->GetGeneratorTargets()) {
+ gt->ClearSourcesCache();
+ }
+ }
+ return true;
+}
+
std::unique_ptr<cmLinkLineComputer> cmGlobalGenerator::CreateLinkLineComputer(
cmOutputConverter* outputConverter, cmStateDirectory const& stateDir) const
{
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index d83b669..b1ce323 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -679,6 +679,7 @@ protected:
bool AddHeaderSetVerification();
bool AddAutomaticSources();
+ bool AddUnitySources();
std::string SelectMakeProgram(const std::string& makeProgram,
const std::string& makeDefault = "") const;
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 55eb9b5..74a6bea 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -828,6 +828,9 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures()
this->NinjaExpectedEncoding = codecvt_Encoding::ANSI;
}
#endif
+ this->NinjaSupportsCWDDepend =
+ !cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, this->NinjaVersion,
+ RequiredNinjaVersionForCWDDepend());
}
void cmGlobalNinjaGenerator::CheckNinjaCodePage()
@@ -1996,6 +1999,11 @@ bool cmGlobalNinjaGenerator::SupportsMultilineDepfile() const
return this->NinjaSupportsMultilineDepfile;
}
+bool cmGlobalNinjaGenerator::SupportsCWDDepend() const
+{
+ return this->NinjaSupportsCWDDepend;
+}
+
bool cmGlobalNinjaGenerator::WriteTargetCleanAdditional(std::ostream& os)
{
const auto& lgr = this->LocalGenerators.at(0);
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 3443643..64eed4d 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -415,10 +415,12 @@ public:
return "1.10.2";
}
static std::string RequiredNinjaVersionForCodePage() { return "1.11"; }
+ static std::string RequiredNinjaVersionForCWDDepend() { return "1.7"; }
bool SupportsDirectConsole() const override;
bool SupportsImplicitOuts() const;
bool SupportsManifestRestat() const;
bool SupportsMultilineDepfile() const;
+ bool SupportsCWDDepend() const;
std::string NinjaOutputPath(std::string const& path) const;
bool HasOutputPathPrefix() const { return !this->OutputPathPrefix.empty(); }
@@ -597,6 +599,7 @@ private:
bool NinjaSupportsMultipleOutputs = false;
bool NinjaSupportsMetadataOnRegeneration = false;
bool NinjaSupportsCodePage = false;
+ bool NinjaSupportsCWDDepend = false;
codecvt_Encoding NinjaExpectedEncoding = codecvt_Encoding::None;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 38c49ed..ab1de4f 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3210,6 +3210,15 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
std::vector<cmSourceFile*> sources;
target->GetSourceFiles(sources, configs[ci]);
for (cmSourceFile* sf : sources) {
+ // Files which need C++ scanning cannot participate in unity builds as
+ // there is a single place in TUs that may perform module-dependency bits
+ // and a unity source cannot `#include` them in-order and represent a
+ // valid TU.
+ if (sf->GetLanguage() == "CXX"_s &&
+ target->NeedDyndepForSource("CXX", configs[ci], sf)) {
+ continue;
+ }
+
auto mi = index.find(sf);
if (mi == index.end()) {
unitySources.emplace_back(sf);
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 8fda774..ff509ce 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -139,7 +139,7 @@ void cmMakefileTargetGenerator::GetTargetLinkFlags(
this->LocalGenerator->AppendFlags(
flags, this->GeneratorTarget->GetSafeProperty("LINK_FLAGS"));
- std::string linkFlagsConfig =
+ std::string const linkFlagsConfig =
cmStrCat("LINK_FLAGS_", cmSystemTools::UpperCase(this->GetConfigName()));
this->LocalGenerator->AppendFlags(
flags, this->GeneratorTarget->GetSafeProperty(linkFlagsConfig));
@@ -236,7 +236,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
}
// Look for ISPC extra object files generated by this target
- auto ispcAdditionalObjs =
+ auto const ispcAdditionalObjs =
this->GeneratorTarget->GetGeneratedISPCObjects(this->GetConfigName());
for (std::string const& ispcObj : ispcAdditionalObjs) {
this->CleanFiles.insert(
@@ -244,7 +244,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
}
// add custom commands to the clean rules?
- bool clean = cmIsOff(this->Makefile->GetProperty("CLEAN_NO_CUSTOM"));
+ bool const clean = cmIsOff(this->Makefile->GetProperty("CLEAN_NO_CUSTOM"));
// First generate the object rule files. Save a list of all object
// files for this target.
@@ -1724,11 +1724,10 @@ void cmMakefileTargetGenerator::GenerateCustomRuleFile(
if (!ccg.GetCC().GetDepfile().empty()) {
// Add dependency over timestamp file for dependencies management
- auto dependTimestamp = cmSystemTools::ConvertToOutputPath(
- this->LocalGenerator->MaybeRelativeToTopBinDir(
- cmStrCat(this->TargetBuildDirectoryFull, "/compiler_depend.ts")));
+ auto dependTimestamp = this->LocalGenerator->MaybeRelativeToTopBinDir(
+ cmStrCat(this->TargetBuildDirectoryFull, "/compiler_depend.ts"));
- depends.push_back(dependTimestamp);
+ depends.emplace_back(std::move(dependTimestamp));
}
// Write the rule.
@@ -1800,7 +1799,6 @@ void cmMakefileTargetGenerator::WriteObjectsVariable(
*this->BuildFileStream << "# Object files for target "
<< this->GeneratorTarget->GetName() << "\n"
<< variableName << " =";
- std::string object;
const auto& lineContinue = this->GlobalGenerator->LineContinueDirective;
cmValue pchExtension = this->Makefile->GetDefinition("CMAKE_PCH_EXTENSION");
@@ -1828,7 +1826,6 @@ void cmMakefileTargetGenerator::WriteObjectsVariable(
<< variableNameExternal << " =";
/* clang-format on */
for (std::string const& obj : this->ExternalObjects) {
- object = this->LocalGenerator->MaybeRelativeToCurBinDir(obj);
*this->BuildFileStream << " " << lineContinue;
*this->BuildFileStream
<< cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(
@@ -1908,7 +1905,7 @@ void cmMakefileTargetGenerator::WriteObjectsStrings(
for (std::string const& obj : this->ExternalObjects) {
helper.Feed(obj);
}
- auto ispcAdditionalObjs =
+ auto const ispcAdditionalObjs =
this->GeneratorTarget->GetGeneratedISPCObjects(this->GetConfigName());
for (std::string const& obj : ispcAdditionalObjs) {
helper.Feed(obj);
@@ -1923,13 +1920,12 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(
std::string dir =
this->LocalGenerator->GetRelativeTargetDirectory(this->GeneratorTarget);
std::string buildTargetRuleName =
- cmStrCat(dir, relink ? "/preinstall" : "/build");
+ cmStrCat(std::move(dir), relink ? "/preinstall" : "/build");
buildTargetRuleName =
this->LocalGenerator->MaybeRelativeToTopBinDir(buildTargetRuleName);
// Build the list of target outputs to drive.
- std::vector<std::string> depends;
- depends.push_back(main_output);
+ std::vector<std::string> depends{ main_output };
const char* comment = nullptr;
if (relink) {
@@ -1972,7 +1968,7 @@ void cmMakefileTargetGenerator::AppendTargetDepends(
}
// Loop over all library dependencies.
- if (cmComputeLinkInformation* cli =
+ if (cmComputeLinkInformation const* cli =
this->GeneratorTarget->GetLinkInformation(cfg)) {
cm::append(depends, cli->GetDepends());
}
@@ -2197,16 +2193,17 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
std::string responseFlag = this->GetResponseFlag(responseMode);
// Create this response file.
- std::string responseFileName =
+ std::string const responseFileName =
(responseMode == Link) ? "linkLibs.rsp" : "deviceLinkLibs.rsp";
- std::string responseLang = (responseMode == Link) ? linkLanguage : "CUDA";
+ std::string const responseLang =
+ (responseMode == Link) ? linkLanguage : "CUDA";
std::string link_rsp = this->CreateResponseFile(
responseFileName, linkLibs, makefile_depends, responseLang);
// Reference the response file.
- linkLibs = cmStrCat(responseFlag,
+ linkLibs = cmStrCat(std::move(responseFlag),
this->LocalGenerator->ConvertToOutputFormat(
- link_rsp, cmOutputConverter::SHELL));
+ std::move(link_rsp), cmOutputConverter::SHELL));
}
}
@@ -2230,7 +2227,7 @@ void cmMakefileTargetGenerator::CreateObjectLists(
responseFileLimit);
// Lookup the response file reference flag.
- std::string responseFlag = this->GetResponseFlag(responseMode);
+ std::string const responseFlag = this->GetResponseFlag(responseMode);
// Write a response file for each string.
const char* sep = "";
@@ -2270,15 +2267,15 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
const std::string& lang,
const std::string& /*config*/)
{
- std::string responseVar =
+ std::string const responseVar =
cmStrCat("CMAKE_", lang, "_USE_RESPONSE_FILE_FOR_INCLUDES");
- bool useResponseFile = this->Makefile->IsOn(responseVar);
+ bool const useResponseFile = this->Makefile->IsOn(responseVar);
std::vector<std::string> includes;
this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget,
lang, this->GetConfigName());
- std::string includeFlags = this->LocalGenerator->GetIncludeFlags(
+ std::string const includeFlags = this->LocalGenerator->GetIncludeFlags(
includes, this->GeneratorTarget, lang, this->GetConfigName(),
useResponseFile);
if (includeFlags.empty()) {
@@ -2293,8 +2290,8 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
if (responseFlag.empty()) {
responseFlag = "@";
}
- std::string name = cmStrCat("includes_", lang, ".rsp");
- std::string arg = std::move(responseFlag) +
+ std::string const name = cmStrCat("includes_", lang, ".rsp");
+ std::string const arg = std::move(responseFlag) +
this->CreateResponseFile(name, includeFlags, this->FlagFileDepends[lang],
lang);
this->LocalGenerator->AppendFlags(flags, arg);
@@ -2323,7 +2320,7 @@ void cmMakefileTargetGenerator::GenDefFile(
cmd += this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->MaybeRelativeToCurBinDir(objlist_file),
cmOutputConverter::SHELL);
- cmValue nm_executable = this->Makefile->GetDefinition("CMAKE_NM");
+ cmValue const nm_executable = this->Makefile->GetDefinition("CMAKE_NM");
if (cmNonempty(nm_executable)) {
cmd += " --nm=";
cmd += this->LocalCommonGenerator->ConvertToOutputFormat(
@@ -2363,7 +2360,7 @@ std::string cmMakefileTargetGenerator::GetResponseFlag(
responseFlagVar = "CMAKE_CUDA_RESPONSE_FILE_DEVICE_LINK_FLAG";
}
- if (cmValue p = this->Makefile->GetDefinition(responseFlagVar)) {
+ if (cmValue const p = this->Makefile->GetDefinition(responseFlagVar)) {
responseFlag = *p;
}
return responseFlag;
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 99ea009..d365ef6 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -453,7 +453,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile,
vars.Language = lang.c_str();
vars.AIXExports = "$AIX_EXPORTS";
- if (this->TargetLinkLanguage(config) == "Swift") {
+ if (!this->GetLocalGenerator()->IsSplitSwiftBuild() &&
+ this->TargetLinkLanguage(config) == "Swift") {
vars.SwiftLibraryName = "$SWIFT_LIBRARY_NAME";
vars.SwiftModule = "$SWIFT_MODULE";
vars.SwiftModuleName = "$SWIFT_MODULE_NAME";
@@ -508,7 +509,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile,
vars.LinkLibraries = "$LINK_PATH $LINK_LIBRARIES";
}
- if (this->TargetLinkLanguage(config) == "Swift") {
+ if (!this->GetLocalGenerator()->IsSplitSwiftBuild() &&
+ this->TargetLinkLanguage(config) == "Swift") {
vars.SwiftSources = responseFlag.c_str();
} else {
vars.Objects = responseFlag.c_str();
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 7ea479e..bc97e88 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -411,28 +411,29 @@ std::string cmNinjaTargetGenerator::GetCompiledSourceNinjaPath(
return this->ConvertToNinjaAbsPath(source->GetFullPath());
}
-std::string cmNinjaTargetGenerator::GetObjectFilePath(
- cmSourceFile const* source, const std::string& config) const
+std::string cmNinjaTargetGenerator::GetObjectFileDir(
+ const std::string& config) const
{
std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
if (!path.empty()) {
path += '/';
}
- std::string const& objectName = this->GeneratorTarget->GetObjectName(source);
- path += cmStrCat(
- this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget),
- this->GetGlobalGenerator()->ConfigDirectory(config), '/', objectName);
+ path +=
+ cmStrCat(this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget),
+ this->GetGlobalGenerator()->ConfigDirectory(config));
return path;
}
-std::string cmNinjaTargetGenerator::GetBmiFilePath(
+std::string cmNinjaTargetGenerator::GetObjectFilePath(
cmSourceFile const* source, const std::string& config) const
{
- std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
- if (!path.empty()) {
- path += '/';
- }
+ std::string const& objectName = this->GeneratorTarget->GetObjectName(source);
+ return cmStrCat(this->GetObjectFileDir(config), '/', objectName);
+}
+std::string cmNinjaTargetGenerator::GetBmiFilePath(
+ cmSourceFile const* source, const std::string& config) const
+{
auto& importedConfigInfo = this->Configs.at(config).ImportedCxxModules;
if (!importedConfigInfo.Initialized()) {
std::string configUpper = cmSystemTools::UpperCase(config);
@@ -444,10 +445,7 @@ std::string cmNinjaTargetGenerator::GetBmiFilePath(
std::string bmiName =
importedConfigInfo.BmiNameForSource(source->GetFullPath());
- path += cmStrCat(
- this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget),
- this->GetGlobalGenerator()->ConfigDirectory(config), '/', bmiName);
- return path;
+ return cmStrCat(this->GetObjectFileDir(config), '/', bmiName);
}
std::string cmNinjaTargetGenerator::GetClangTidyReplacementsFilePath(
@@ -1025,6 +1023,15 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
}
}
+ if (!this->GetGlobalGenerator()->SupportsCWDDepend()) {
+ // Ensure that the object directory exists. If there are no objects in the
+ // target (e.g., an empty `OBJECT` library), the directory is still listed
+ // as an order-only depends in the build files. Alternate `ninja`
+ // implementations may not allow this (such as `samu`). See #25526.
+ auto const objectDir = this->GetObjectFileDir(config);
+ this->EnsureDirectoryExists(objectDir);
+ }
+
{
cmNinjaBuild build("phony");
build.Comment =
@@ -1099,11 +1106,15 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
// that "output ... of phony edge with no inputs doesn't exist" and
// consider the phony output "dirty".
if (orderOnlyDeps.empty()) {
- // Any path that always exists will work here. It would be nice to
- // use just "." but that is not supported by Ninja < 1.7.
- std::string tgtDir = cmStrCat(
- this->LocalGenerator->GetCurrentBinaryDirectory(), '/',
- this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget));
+ std::string tgtDir;
+ if (this->GetGlobalGenerator()->SupportsCWDDepend()) {
+ tgtDir = ".";
+ } else {
+ // Any path that always exists will work here.
+ tgtDir = cmStrCat(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), '/',
+ this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget));
+ }
orderOnlyDeps.push_back(this->ConvertToNinjaPath(tgtDir));
}
@@ -1916,7 +1927,6 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
// indistinguishable from the old behavior.
//
// FIXME(#25490): Add response file support to Swift object build step
- // FIXME(#25491): Include all files in module in compile_commands.json
if (sources.empty()) {
return;
@@ -1951,6 +1961,10 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
this->LanguageCompilerRule(language, config, WithScanning::No));
cmNinjaVars& vars = objBuild.Variables;
+ // The swift toolchain leaves outputs untouched if there are no meaningful
+ // changes to input files (e.g. addition of a comment).
+ vars.emplace("restat", "1");
+
std::string const moduleName =
getTargetPropertyOrDefault(target, "Swift_MODULE_NAME", target.GetName());
std::string const moduleDirectory = getTargetPropertyOrDefault(
@@ -1973,6 +1987,18 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
return !isMultiThread && compileMode == cmSwiftCompileMode::Wholemodule;
}();
+ // Without `-emit-library` or `-emit-executable`, targets with a single
+ // source file parse as a Swift script instead of like normal source. For
+ // non-executable targets, append this to ensure that they are parsed like a
+ // normal source.
+ if (target.GetType() != cmStateEnums::EXECUTABLE) {
+ this->LocalGenerator->AppendFlags(vars["FLAGS"], "-parse-as-library");
+ }
+
+ if (target.GetType() == cmStateEnums::STATIC_LIBRARY) {
+ this->LocalGenerator->AppendFlags(vars["FLAGS"], "-static");
+ }
+
// Swift modules only make sense to emit from things that can be imported.
// Executables that don't export symbols can't be imported, so don't try to
// emit a swiftmodule for them. It will break.
@@ -1997,14 +2023,6 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
vars["FLAGS"], cmStrCat(libraryLinkNameFlag, ' ', libraryLinkName));
}
- // Without `-emit-library` or `-emit-executable`, targets with a single
- // source file parse as a Swift script instead of like normal source. For
- // non-executable targets, append this to ensure that they are parsed like a
- // normal source.
- if (target.GetType() != cmStateEnums::EXECUTABLE) {
- this->LocalGenerator->AppendFlags(vars["FLAGS"], "-parse-as-library");
- }
-
this->LocalGenerator->AppendFlags(vars["FLAGS"],
this->GetFlags(language, config));
vars["DEFINES"] = this->GetDefines(language, config);
@@ -2014,6 +2032,7 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
std::string const targetObjectFilename = this->ConvertToNinjaPath(cmStrCat(
objectDir, '/', moduleName,
this->GetGlobalGenerator()->GetLanguageOutputExtension(language)));
+ objBuild.RspFile = cmStrCat(targetObjectFilename, ".swift.rsp");
if (isSingleOutput) {
this->LocalGenerator->AppendFlags(vars["FLAGS"],
@@ -2027,15 +2046,7 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
std::string const sourceFilePath = this->GetCompiledSourceNinjaPath(sf);
objBuild.ExplicitDeps.push_back(sourceFilePath);
- if (isSingleOutput) {
- if (firstForConfig) {
- this->ExportObjectCompileCommand(
- language, sourceFilePath, objectDir, targetObjectFilename,
- cmSystemTools::GetFilenamePath(targetObjectFilename), vars["FLAGS"],
- vars["DEFINES"], vars["INCLUDES"],
- /*compile pdb*/ "", /*target pdb*/ "", config, WithScanning::No);
- }
- } else {
+ if (!isSingleOutput) {
// Object outputs
std::string const objectFilepath =
this->ConvertToNinjaPath(this->GetObjectFilePath(sf, config));
@@ -2045,16 +2056,6 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
// Add OFM data
this->EmitSwiftDependencyInfo(sf, config);
-
- // Emit compile commands
- if (firstForConfig) {
- this->ExportObjectCompileCommand(
- language, sourceFilePath, objectDir, objectFilepath,
- cmSystemTools::GetFilenamePath(objectFilepath), vars["FLAGS"],
- vars["DEFINES"], vars["INCLUDES"],
- /*compile pdb*/ "",
- /*target pdb*/ "", config, WithScanning::No);
- }
}
}
@@ -2062,6 +2063,12 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
this->GenerateSwiftOutputFileMap(config, vars["FLAGS"]);
}
+ if (firstForConfig) {
+ this->ExportSwiftObjectCompileCommand(
+ sources, targetObjectFilename, vars["FLAGS"], vars["DEFINES"],
+ vars["INCLUDES"], config, isSingleOutput);
+ }
+
for (cmTargetDepend const& dep :
this->GetGlobalGenerator()->GetTargetDirectDepends(&target)) {
if (!dep->IsLanguageUsed("Swift", config)) {
@@ -2085,7 +2092,8 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
// Write object build
this->GetGlobalGenerator()->WriteBuild(this->GetImplFileStream(fileConfig),
- objBuild);
+ objBuild,
+ this->ForceResponseFile() ? -1 : 0);
}
void cmNinjaTargetGenerator::WriteTargetDependInfo(std::string const& lang,
@@ -2326,6 +2334,77 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
objectFileName);
}
+void cmNinjaTargetGenerator::ExportSwiftObjectCompileCommand(
+ std::vector<cmSourceFile const*> const& moduleSourceFiles,
+ std::string const& moduleObjectFilename, std::string const& flags,
+ std::string const& defines, std::string const& includes,
+ std::string const& outputConfig, bool singleOutput)
+{
+ if (!this->GeneratorTarget->GetPropertyAsBool("EXPORT_COMPILE_COMMANDS")) {
+ return;
+ }
+
+ auto escapeSourceFileName = [this](std::string srcFilename) -> std::string {
+ if (!cmSystemTools::FileIsFullPath(srcFilename)) {
+ srcFilename =
+ cmSystemTools::CollapseFullPath(srcFilename,
+ this->GetGlobalGenerator()
+ ->GetCMakeInstance()
+ ->GetHomeOutputDirectory());
+ }
+
+ return this->LocalGenerator->ConvertToOutputFormat(
+ srcFilename, cmOutputConverter::SHELL);
+ };
+
+ cmRulePlaceholderExpander::RuleVariables compileObjectVars;
+ compileObjectVars.Language = "Swift";
+ compileObjectVars.Flags = flags.c_str();
+ compileObjectVars.Defines = defines.c_str();
+ compileObjectVars.Includes = includes.c_str();
+
+ // Build up the list of source files in the module
+ std::vector<std::string> filenames;
+ filenames.reserve(moduleSourceFiles.size());
+ for (cmSourceFile const* sf : moduleSourceFiles) {
+ filenames.emplace_back(
+ escapeSourceFileName(this->GetCompiledSourceNinjaPath(sf)));
+ }
+ // Note that `escapedSourceFilenames` must remain alive until the
+ // compileObjectVars is consumed or Source will be a dangling pointer.
+ std::string const escapedSourceFilenames = cmJoin(filenames, " ");
+ compileObjectVars.Source = escapedSourceFilenames.c_str();
+
+ std::string const& compileCommand =
+ this->Makefile->GetRequiredDefinition("CMAKE_Swift_COMPILE_OBJECT");
+ cmList compileCmds(compileCommand);
+
+ auto rulePlaceholderExpander =
+ this->GetLocalGenerator()->CreateRulePlaceholderExpander();
+
+ for (cmSourceFile const* sf : moduleSourceFiles) {
+ std::string const sourceFilename = this->GetCompiledSourceNinjaPath(sf);
+ std::string objectFilename = moduleObjectFilename;
+
+ if (!singleOutput) {
+ // If it's not single-output, each source file gets a separate object
+ objectFilename = this->GetObjectFilePath(sf, outputConfig);
+ }
+ compileObjectVars.Objects = objectFilename.c_str();
+
+ for (std::string& cmd : compileCmds) {
+ rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(),
+ cmd, compileObjectVars);
+ }
+
+ std::string commandLine = this->GetLocalGenerator()->BuildCommandLine(
+ compileCmds, outputConfig, outputConfig);
+
+ this->GetGlobalGenerator()->AddCXXCompileCommand(
+ commandLine, sourceFilename, objectFilename);
+ }
+}
+
void cmNinjaTargetGenerator::AdditionalCleanFiles(const std::string& config)
{
if (cmValue prop_value =
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index b55c460..2bfed80 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -128,6 +128,7 @@ protected:
/// @return the source file path for the given @a source.
std::string GetCompiledSourceNinjaPath(cmSourceFile const* source) const;
+ std::string GetObjectFileDir(const std::string& config) const;
/// @return the object file path for the given @a source.
std::string GetObjectFilePath(cmSourceFile const* source,
const std::string& config) const;
@@ -195,6 +196,12 @@ protected:
std::string const& targetCompilePdb, std::string const& targetPdb,
std::string const& outputConfig, WithScanning withScanning);
+ void ExportSwiftObjectCompileCommand(
+ std::vector<cmSourceFile const*> const& moduleSourceFiles,
+ std::string const& moduleObjectFilename, std::string const& flags,
+ std::string const& defines, std::string const& includes,
+ std::string const& outputConfig, bool singleOutput);
+
void AdditionalCleanFiles(const std::string& config);
cmNinjaDeps GetObjects(const std::string& config) const;
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index f038c6b..3f20dc0 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -484,7 +484,7 @@ class cmMakefile;
SELECT(POLICY, CMP0158, \
"add_test() honors CMAKE_CROSSCOMPILING_EMULATOR only when " \
"cross-compiling.", \
- 3, 28, 0, cmPolicies::WARN)
+ 3, 29, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 1bbd934..d572f30 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2784,7 +2784,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
isCppModule = true;
if (shouldScanForModules &&
this->GlobalGenerator->IsScanDependenciesSupported()) {
- // ScanSourceforModuleDependencies uses 'cl /scanDependencies' and
+ // ScanSourceForModuleDependencies uses 'cl /scanDependencies' and
// can distinguish module interface units and internal partitions.
compileAsPerConfig = "CompileAsCpp";
} else {
@@ -2827,7 +2827,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
// use them
if (!flags.empty() || !options.empty() || !configDefines.empty() ||
!includes.empty() || compileAsPerConfig || noWinRT ||
- !options.empty() || needsPCHFlags) {
+ !options.empty() || needsPCHFlags || shouldScanForModules) {
cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator;
cmIDEFlagTable const* flagtable = nullptr;
const std::string& srclang = source->GetLanguage();
@@ -2856,9 +2856,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
clOptions.AddFlag("CompileAs", compileAsPerConfig);
}
if (shouldScanForModules) {
- clOptions.AddFlag("ScanSourceforModuleDependencies", "true");
- } else {
- clOptions.AddFlag("ScanSourceforModuleDependencies", "false");
+ clOptions.AddFlag("ScanSourceForModuleDependencies", "true");
}
if (noWinRT) {
clOptions.AddFlag("CompileAsWinRT", "false");
@@ -3574,6 +3572,9 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
e2.Element("AdditionalUsingDirectories", dirs);
}
}
+
+ // Disable C++ source scanning by default.
+ e2.Element("ScanSourceForModuleDependencies", "false");
}
bool cmVisualStudio10TargetGenerator::ComputeRcOptions()
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index fa38a65..b2867e2 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -25,7 +25,7 @@ const cmDocumentationEntry cmDocumentationName = {
const cmDocumentationEntry cmDocumentationUsage = { {}, " ctest [options]" };
-const cmDocumentationEntry cmDocumentationOptions[74] = {
+const cmDocumentationEntry cmDocumentationOptions[] = {
{ "--preset <preset>, --preset=<preset>",
"Read arguments from a test preset." },
{ "--list-presets", "List available test presets." },
@@ -143,6 +143,7 @@ const cmDocumentationEntry cmDocumentationOptions[74] = {
{ "--tomorrow-tag", "Nightly or experimental starts with next day tag." },
{ "--overwrite", "Overwrite CTest configuration option." },
{ "--extra-submit <file>[;<file>]", "Submit extra files to the dashboard." },
+ { "--http-header <header>", "Append HTTP header when submitting" },
{ "--force-new-ctest-process",
"Run child CTest instances as new processes" },
{ "--schedule-random", "Use a random order for scheduling tests" },
diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt
index a41b44e..30cabf1 100644
--- a/Tests/CMakeOnly/CMakeLists.txt
+++ b/Tests/CMakeOnly/CMakeLists.txt
@@ -25,6 +25,13 @@ add_CMakeOnly_test(CheckCXXSymbolExists)
add_CMakeOnly_test(CheckCXXCompilerFlag)
add_CMakeOnly_test(CheckLanguage)
+if (CMake_TEST_HIP)
+ set_property(TEST CMakeOnly.CheckLanguage APPEND PROPERTY LABELS "HIP")
+ add_CMakeOnly_test(CheckLanguageHIPPlatform)
+ set_property(TEST CMakeOnly.CheckLanguageHIPPlatform APPEND PROPERTY LABELS "HIP")
+ add_CMakeOnly_test(CheckLanguageHIPPlatform2)
+ set_property(TEST CMakeOnly.CheckLanguageHIPPlatform2 APPEND PROPERTY LABELS "HIP")
+endif()
add_CMakeOnly_test(CheckStructHasMember)
diff --git a/Tests/CMakeOnly/CheckLanguageHIPPlatform/CMakeLists.txt b/Tests/CMakeOnly/CheckLanguageHIPPlatform/CMakeLists.txt
new file mode 100644
index 0000000..03b8aa0
--- /dev/null
+++ b/Tests/CMakeOnly/CheckLanguageHIPPlatform/CMakeLists.txt
@@ -0,0 +1,17 @@
+cmake_minimum_required (VERSION 3.28)
+project(CheckLanguageHIPPlatform NONE)
+include(CheckLanguage)
+
+check_language(HIP)
+
+if(NOT DEFINED CMAKE_HIP_COMPILER)
+ message(FATAL_ERROR "check_language did not set result")
+endif()
+
+if (NOT CMAKE_HIP_COMPILER)
+ message(FATAL_ERROR "check_language should not fail!")
+endif()
+
+if (NOT DEFINED CMAKE_HIP_PLATFORM)
+ message(FATAL_ERROR "check_language did not set CMAKE_HIP_PLATFORM!")
+endif()
diff --git a/Tests/CMakeOnly/CheckLanguageHIPPlatform2/CMakeLists.txt b/Tests/CMakeOnly/CheckLanguageHIPPlatform2/CMakeLists.txt
new file mode 100644
index 0000000..f251c49
--- /dev/null
+++ b/Tests/CMakeOnly/CheckLanguageHIPPlatform2/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required (VERSION 3.28)
+project(CheckLanguageHIPPlatform2 NONE)
+include(CheckLanguage)
+
+set(CMAKE_HIP_PLATFORM "not-a-hip-platform" CACHE STRING "")
+check_language(HIP)
+
+if(NOT DEFINED CMAKE_HIP_COMPILER)
+ message(FATAL_ERROR "check_language did not set result")
+endif()
+
+if (CMAKE_HIP_COMPILER)
+ message(FATAL_ERROR "check_language should have failed")
+endif()
diff --git a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake
index 19c09c8..c3725a4 100644
--- a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake
+++ b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake
@@ -24,6 +24,17 @@ add_library(toplib STATIC toplib.c)
add_subdirectory(DepfileSubdir)
+set(TEST_SPACE 1)
+if(CMAKE_GENERATOR STREQUAL "Unix Makefiles")
+ execute_process(COMMAND "${CMAKE_MAKE_PROGRAM}" no_such_target --version RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out)
+ if(NOT res EQUAL 0 OR NOT out MATCHES "GNU")
+ set(TEST_SPACE 0)
+ endif()
+endif()
+if(TEST_SPACE)
+ add_subdirectory(DepfileSubdirWithSpace)
+endif()
+
add_custom_command(
OUTPUT toplib2.c
DEPFILE toplib2.c.d
diff --git a/Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/CMakeLists.txt b/Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/CMakeLists.txt
new file mode 100644
index 0000000..204f740
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/CMakeLists.txt
@@ -0,0 +1,2 @@
+
+add_subdirectory("path with space")
diff --git a/Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/path with space/CMakeLists.txt b/Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/path with space/CMakeLists.txt
new file mode 100644
index 0000000..37c0a57
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/path with space/CMakeLists.txt
@@ -0,0 +1,9 @@
+
+add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/dummy.txt"
+ COMMAND ${CMAKE_COMMAND} -E touch "${CMAKE_CURRENT_BINARY_DIR}/dummy.txt"
+ DEPFILE dummy.txt.d
+)
+
+add_custom_target(subdir_space ALL
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/dummy.txt"
+)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index dbcb94e..cbd9cbc 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -345,7 +345,17 @@ if(DEFINED CMake_TEST_OBJC)
list(APPEND CompilerTest_ARGS -DCMake_TEST_OBJC=${CMake_TEST_OBJC})
endif()
if(CMAKE_Fortran_COMPILER)
- list(APPEND CompilerTest_ARGS -DCMake_TEST_Fortran=1)
+ # lfortran < 1.24 cannot handle long file names. Fortran is not
+ # enabled here, so check the C compiler version instead.
+ if(CMAKE_C_COMPILER_ID STREQUAL "LCC" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "1.24")
+ string(LENGTH "${CMAKE_CURRENT_BINARY_DIR}" _CCBD_LEN)
+ if(_CCBD_LEN LESS 35)
+ list(APPEND CompilerTest_ARGS -DCMake_TEST_Fortran=1)
+ endif()
+ unset(_CCBD_LEN)
+ else()
+ list(APPEND CompilerTest_ARGS -DCMake_TEST_Fortran=1)
+ endif()
endif()
foreach(lang IN ITEMS CUDA HIP ISPC)
if(CMake_TEST_${lang})
@@ -434,8 +444,11 @@ endif()
add_RunCMake_test(ObjectLibrary)
add_RunCMake_test(ParseImplicitIncludeInfo)
add_RunCMake_test(ParseImplicitLinkInfo)
-if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
- add_RunCMake_test(RuntimePath)
+if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
+ add_RunCMake_test(RuntimePath
+ -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
+ -DCMAKE_EXECUTABLE_FORMAT=${CMAKE_EXECUTABLE_FORMAT}
+ )
endif()
add_RunCMake_test(ScriptMode)
add_RunCMake_test(Swift -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
@@ -888,6 +901,9 @@ if(CMake_TEST_RunCMake_ExternalProject_DOWNLOAD_SERVER_TIMEOUT)
list(APPEND ExternalProject_ARGS -DDOWNLOAD_SERVER_TIMEOUT=${CMake_TEST_RunCMake_ExternalProject_DOWNLOAD_SERVER_TIMEOUT})
endif()
add_RunCMake_test(ExternalProject -DDETECT_JOBSERVER=$<TARGET_FILE:detect_jobserver>)
+if(CMake_TEST_RunCMake_ExternalProject_RUN_SERIAL)
+ set_property(TEST RunCMake.ExternalProject PROPERTY RUN_SERIAL TRUE)
+endif()
add_RunCMake_test(FetchContent)
add_RunCMake_test(FetchContent_find_package)
set(CTestCommandLine_ARGS -DPython_EXECUTABLE=${Python_EXECUTABLE})
@@ -1034,6 +1050,31 @@ set(cpack_tests
if(APPLE)
list(APPEND cpack_tests DragNDrop)
endif()
+
+if(CMAKE_SYSTEM_PROCESSOR STREQUAL "e2k" AND NOT DEFINED CMake_TEST_E2K_BROKEN_LIBC)
+ # Exclude tests that fail due to a broken libc version on Elbrus.
+ find_program(DPKG_QUERY "dpkg-query" )
+ execute_process(COMMAND "${DPKG_QUERY}" "-f" "\${Version}" "-W" "glibc" OUTPUT_VARIABLE LIBC_VERSION)
+ if(LIBC_VERSION MATCHES "2.29-25.*")
+ list(REMOVE_ITEM cpack_tests
+ DEB.AUTO_SUFFIXES
+ DEB.CUSTOM_NAMES
+ DEB.DEB_PACKAGE_VERSION_BACK_COMPATIBILITY
+ DEB.PROJECT_META DEB.DEPENDENCIES
+ RPM.PARTIALLY_RELOCATABLE_WARNING
+ RPM.PER_COMPONENT_FIELDS
+ RPM.USER_FILELIST
+ RPM.DIST
+ RPM.AUTO_SUFFIXES
+ TGZ
+ ZIP
+ STGZ
+ External
+ )
+ set(CMake_TEST_E2K_BROKEN_LIBC 1)
+ endif()
+endif()
+
add_RunCMake_test_group(CPack "${cpack_tests}")
# add a test to make sure symbols are exported from a shared library
# for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used
@@ -1088,14 +1129,16 @@ add_RunCMake_test(CMakePresetsBuild
-DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
)
-add_RunCMake_test(CMakePresetsTest
- -DPython_EXECUTABLE=${Python_EXECUTABLE}
- -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
- )
-add_RunCMake_test(CMakePresetsPackage
- -DPython_EXECUTABLE=${Python_EXECUTABLE}
- -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
- )
+if(NOT CMake_TEST_E2K_BROKEN_LIBC)
+ add_RunCMake_test(CMakePresetsTest
+ -DPython_EXECUTABLE=${Python_EXECUTABLE}
+ -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
+ )
+ add_RunCMake_test(CMakePresetsPackage
+ -DPython_EXECUTABLE=${Python_EXECUTABLE}
+ -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
+ )
+endif()
add_RunCMake_test(CMakePresetsWorkflow
-DPython_EXECUTABLE=${Python_EXECUTABLE}
-DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
index fcfa60a..abede44 100644
--- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
@@ -170,7 +170,9 @@ run_cxx_module_test(scan-with-pch)
# Tests which use named modules.
if ("named" IN_LIST CMake_TEST_MODULE_COMPILATION)
run_cxx_module_test(simple)
+ run_cxx_module_test(vs-without-flags)
run_cxx_module_test(library library-static -DBUILD_SHARED_LIBS=OFF)
+ run_cxx_module_test(unity-build)
run_cxx_module_test(object-library)
run_cxx_module_test(generated)
run_cxx_module_test(deep-chain)
diff --git a/Tests/RunCMake/CXXModules/examples/scan_properties/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/scan_properties/CMakeLists.txt
index 47be1d9..110e411 100644
--- a/Tests/RunCMake/CXXModules/examples/scan_properties/CMakeLists.txt
+++ b/Tests/RunCMake/CXXModules/examples/scan_properties/CMakeLists.txt
@@ -18,8 +18,10 @@ string(REPLACE "<DEFINES>" "<DEFINES> -DCMAKE_SCANNED_THIS_SOURCE"
set_property(SOURCE always_scan.cxx
PROPERTY CXX_SCAN_FOR_MODULES 1)
-set_property(SOURCE never_scan.cxx
+set_property(SOURCE never_scan.ixx
PROPERTY CXX_SCAN_FOR_MODULES 0)
+set_property(SOURCE never_scan.ixx
+ PROPERTY LANGUAGE CXX)
add_executable(scans_everything)
target_sources(scans_everything
@@ -27,7 +29,7 @@ target_sources(scans_everything
main.cxx
join.cxx
always_scan.cxx
- never_scan.cxx
+ never_scan.ixx
PRIVATE
FILE_SET CXX_MODULES
BASE_DIRS
@@ -46,7 +48,7 @@ target_sources(no_scan_everything
main.cxx
join.cxx
always_scan.cxx
- never_scan.cxx
+ never_scan.ixx
PRIVATE
FILE_SET CXX_MODULES
BASE_DIRS
diff --git a/Tests/RunCMake/CXXModules/examples/scan_properties/never_scan.cxx b/Tests/RunCMake/CXXModules/examples/scan_properties/never_scan.ixx
index b47510b..b47510b 100644
--- a/Tests/RunCMake/CXXModules/examples/scan_properties/never_scan.cxx
+++ b/Tests/RunCMake/CXXModules/examples/scan_properties/never_scan.ixx
diff --git a/Tests/RunCMake/CXXModules/examples/unity-build/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/unity-build/CMakeLists.txt
new file mode 100644
index 0000000..ce1751d
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/unity-build/CMakeLists.txt
@@ -0,0 +1,26 @@
+cmake_minimum_required(VERSION 3.28)
+project(cxx_modules_unity CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+set(CMAKE_UNITY_BUILD 1)
+
+add_executable(unity)
+target_sources(unity
+ PRIVATE
+ main.cxx
+ unity1.cxx
+ unity2.cxx
+ PRIVATE
+ FILE_SET CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ importable.cxx)
+target_compile_features(unity PUBLIC cxx_std_20)
+
+set_property(SOURCE unity1.cxx unity2.cxx
+ PROPERTY
+ CXX_SCAN_FOR_MODULES 0)
+
+add_test(NAME unity COMMAND unity)
diff --git a/Tests/RunCMake/CXXModules/examples/unity-build/importable.cxx b/Tests/RunCMake/CXXModules/examples/unity-build/importable.cxx
new file mode 100644
index 0000000..148b033
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/unity-build/importable.cxx
@@ -0,0 +1,10 @@
+module;
+
+#include "unity.h"
+
+export module importable;
+
+export int from_import()
+{
+ return unity1() + unity2();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/unity-build/main.cxx b/Tests/RunCMake/CXXModules/examples/unity-build/main.cxx
new file mode 100644
index 0000000..feb38d2
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/unity-build/main.cxx
@@ -0,0 +1,6 @@
+import importable;
+
+int main(int argc, char* argv[])
+{
+ return from_import();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/unity-build/unity.h b/Tests/RunCMake/CXXModules/examples/unity-build/unity.h
new file mode 100644
index 0000000..4a65a4b
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/unity-build/unity.h
@@ -0,0 +1,7 @@
+#ifndef unity_h
+#define unity_h
+
+int unity1();
+int unity2();
+
+#endif
diff --git a/Tests/RunCMake/CXXModules/examples/unity-build/unity1.cxx b/Tests/RunCMake/CXXModules/examples/unity-build/unity1.cxx
new file mode 100644
index 0000000..fd1cbb3
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/unity-build/unity1.cxx
@@ -0,0 +1,8 @@
+#include "unity.h"
+
+#define DETECT_UNITY
+
+int unity1()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/unity-build/unity2.cxx b/Tests/RunCMake/CXXModules/examples/unity-build/unity2.cxx
new file mode 100644
index 0000000..0f25cff
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/unity-build/unity2.cxx
@@ -0,0 +1,10 @@
+#include "unity.h"
+
+#ifndef DETECT_UNITY
+# error "Should have detected a unity build"
+#endif
+
+int unity2()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/vs-without-flags/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/vs-without-flags/CMakeLists.txt
new file mode 100644
index 0000000..0d18a66
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/vs-without-flags/CMakeLists.txt
@@ -0,0 +1,22 @@
+cmake_minimum_required(VERSION 3.28)
+project(cxx_modules_vs_without_flags CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+set(CMAKE_CXX_STANDARD 23)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_EXTENSIONS OFF)
+set(CMAKE_CXX_SCAN_FOR_MODULES ON)
+
+add_executable(vs_without_flags)
+target_sources(vs_without_flags
+ PRIVATE
+ main.cxx
+ PRIVATE
+ FILE_SET CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ module.cxx)
+
+add_test(NAME vs_without_flags COMMAND vs_without_flags)
diff --git a/Tests/RunCMake/CXXModules/examples/vs-without-flags/main.cxx b/Tests/RunCMake/CXXModules/examples/vs-without-flags/main.cxx
new file mode 100644
index 0000000..239ab00
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/vs-without-flags/main.cxx
@@ -0,0 +1,6 @@
+import mod;
+
+int main(int argc, char* argv[])
+{
+ return f();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/vs-without-flags/module.cxx b/Tests/RunCMake/CXXModules/examples/vs-without-flags/module.cxx
new file mode 100644
index 0000000..27a61a6
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/vs-without-flags/module.cxx
@@ -0,0 +1,6 @@
+export module mod;
+
+export int f()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesFortran.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesFortran.cmake
index 48dc525..68c5735 100644
--- a/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesFortran.cmake
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesFortran.cmake
@@ -5,6 +5,14 @@ include(CheckSourceCompiles)
set(Fortran 1) # test that this is tolerated
+# lfortran < 1.24 cannot handle long file names.
+if(CMAKE_Fortran_COMPILER_ID STREQUAL "LCC" AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS "1.24")
+ string(LENGTH "${CMAKE_CURRENT_BINARY_DIR}" _CCBD_LEN)
+ if(_CCBD_LEN GREATER_EQUAL 35)
+ return()
+ endif()
+endif()
+
check_source_compiles(Fortran [=[
PROGRAM TEST_HAVE_PRINT
PRINT *, 'Hello'
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsFortran.cmake b/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsFortran.cmake
index 50e8ec8..fc5506a 100644
--- a/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsFortran.cmake
+++ b/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsFortran.cmake
@@ -5,6 +5,14 @@ include(CheckSourceRuns)
set(Fortran 1) # test that this is tolerated
+# lfortran < 1.24 cannot handle long file names.
+if(CMAKE_Fortran_COMPILER_ID STREQUAL "LCC" AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS "1.24")
+ string(LENGTH "${CMAKE_CURRENT_BINARY_DIR}" _CCBD_LEN)
+ if(_CCBD_LEN GREATER_EQUAL 35)
+ return()
+ endif()
+endif()
+
check_source_runs(Fortran [=[
PROGRAM TEST_HAVE_PRINT
PRINT *, 'Hello'
diff --git a/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake b/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake
index ad446e9..180a0fe 100644
--- a/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake
+++ b/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake
@@ -21,12 +21,39 @@ if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
set(cfg_dir /Debug)
endif()
-run_RuntimePath(SymlinkImplicit)
-run_cmake_command(SymlinkImplicitCheck
- ${CMAKE_COMMAND} -Ddir=${RunCMake_BINARY_DIR}/SymlinkImplicit-build -Dcfg_dir=${cfg_dir} -P ${RunCMake_SOURCE_DIR}/SymlinkImplicitCheck.cmake)
+if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
+ run_RuntimePath(SymlinkImplicit)
+ run_cmake_command(SymlinkImplicitCheck
+ ${CMAKE_COMMAND} -Ddir=${RunCMake_BINARY_DIR}/SymlinkImplicit-build -Dcfg_dir=${cfg_dir} -P ${RunCMake_SOURCE_DIR}/SymlinkImplicitCheck.cmake)
-run_RuntimePath(Relative)
+ run_RuntimePath(Relative)
-run_RuntimePath(Genex)
-run_cmake_command(GenexCheck
- ${CMAKE_COMMAND} -Ddir=${RunCMake_BINARY_DIR}/Genex-build -P ${RunCMake_SOURCE_DIR}/GenexCheck.cmake)
+ run_RuntimePath(Genex)
+ run_cmake_command(GenexCheck
+ ${CMAKE_COMMAND} -Ddir=${RunCMake_BINARY_DIR}/Genex-build -P ${RunCMake_SOURCE_DIR}/GenexCheck.cmake)
+endif()
+
+block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Stub-build)
+ if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(bin_dir "${RunCMake_TEST_BINARY_DIR}/Debug")
+ set(lib_dir "${RunCMake_TEST_BINARY_DIR}/lib/Debug")
+ else()
+ set(bin_dir "${RunCMake_TEST_BINARY_DIR}")
+ set(lib_dir "${RunCMake_TEST_BINARY_DIR}/lib")
+ endif()
+ run_cmake(Stub)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(Stub-build ${CMAKE_COMMAND} --build . --config Debug)
+ if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|SunOS)$|BSD")
+ set(ldpath LD_LIBRARY_PATH)
+ elseif(CMAKE_SYSTEM_NAME MATCHES "^(Darwin)$")
+ set(ldpath DYLD_LIBRARY_PATH)
+ elseif(CMAKE_SYSTEM_NAME MATCHES "^(AIX)$")
+ set(ldpath LIBPATH)
+ endif()
+ if(ldpath)
+ run_cmake_command(Stub-fail ${CMAKE_COMMAND} -E env LANG=C ${bin_dir}/StubExe)
+ run_cmake_command(Stub-pass ${CMAKE_COMMAND} -E env --modify ${ldpath}=path_list_prepend:${lib_dir} ${bin_dir}/StubExe)
+ endif()
+endblock()
diff --git a/Tests/RunCMake/RuntimePath/Stub-fail-result.txt b/Tests/RunCMake/RuntimePath/Stub-fail-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/RuntimePath/Stub-fail-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/RuntimePath/Stub-fail-stderr.txt b/Tests/RunCMake/RuntimePath/Stub-fail-stderr.txt
new file mode 100644
index 0000000..9c17414
--- /dev/null
+++ b/Tests/RunCMake/RuntimePath/Stub-fail-stderr.txt
@@ -0,0 +1 @@
+(error while loading shared libraries: libStub\.so\.1|Library not loaded: '?@rpath/libStub\.1\.dylib'?|(Cannot|Could not) load module libStub\.so|fatal: libStub\.so\.1: open failed|Shared object "libStub\.so\.1" not found)
diff --git a/Tests/RunCMake/RuntimePath/Stub.c b/Tests/RunCMake/RuntimePath/Stub.c
new file mode 100644
index 0000000..2ff333a
--- /dev/null
+++ b/Tests/RunCMake/RuntimePath/Stub.c
@@ -0,0 +1,4 @@
+int Stub(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/RuntimePath/Stub.cmake b/Tests/RunCMake/RuntimePath/Stub.cmake
new file mode 100644
index 0000000..18e99c1
--- /dev/null
+++ b/Tests/RunCMake/RuntimePath/Stub.cmake
@@ -0,0 +1,25 @@
+enable_language(C)
+
+add_library(Stub SHARED Stub.c)
+set_target_properties(Stub PROPERTIES
+ SOVERSION 1
+ LIBRARY_OUTPUT_DIRECTORY lib
+ )
+
+set(StubDir ${CMAKE_CURRENT_BINARY_DIR}/lib/stubs)
+set(Stub "${StubDir}/${CMAKE_SHARED_LIBRARY_PREFIX}Stub${CMAKE_SHARED_LIBRARY_SUFFIX}")
+add_custom_target(StubCopy
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${StubDir}"
+ COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_SONAME_FILE:Stub>" "${Stub}"
+ BYPRODUCTS ${Stub}
+ )
+add_dependencies(StubCopy Stub)
+add_library(Imp::Stub SHARED IMPORTED)
+set_property(TARGET Imp::Stub PROPERTY IMPORTED_IMPLIB "${Stub}")
+add_dependencies(Imp::Stub StubCopy)
+
+add_library(StubUse SHARED StubUse.c)
+target_link_libraries(StubUse PRIVATE Imp::Stub)
+
+add_executable(StubExe StubExe.c)
+target_link_libraries(StubExe PRIVATE StubUse)
diff --git a/Tests/RunCMake/RuntimePath/StubExe.c b/Tests/RunCMake/RuntimePath/StubExe.c
new file mode 100644
index 0000000..14b3fe4
--- /dev/null
+++ b/Tests/RunCMake/RuntimePath/StubExe.c
@@ -0,0 +1,5 @@
+extern int StubUse(void);
+int main(void)
+{
+ return StubUse();
+}
diff --git a/Tests/RunCMake/RuntimePath/StubUse.c b/Tests/RunCMake/RuntimePath/StubUse.c
new file mode 100644
index 0000000..ffdaf6d
--- /dev/null
+++ b/Tests/RunCMake/RuntimePath/StubUse.c
@@ -0,0 +1,5 @@
+extern int Stub(void);
+int StubUse(void)
+{
+ return Stub();
+}
diff --git a/Tests/RunCMake/Swift/CompileCommands-check.cmake b/Tests/RunCMake/Swift/CompileCommands-check.cmake
new file mode 100644
index 0000000..6450745
--- /dev/null
+++ b/Tests/RunCMake/Swift/CompileCommands-check.cmake
@@ -0,0 +1,30 @@
+if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/compile_commands.json")
+ set(RunCMake_TEST_FAILED "compile_commands.json not generated")
+ return()
+endif()
+
+# The compile command for both files should contain all Swift source files in
+# the module
+set(expected_compile_commands
+[==[^\[
+{
+ "directory": ".*(/Tests/RunCMake/Swift/CompileCommands-build|\\\\Tests\\\\RunCMake\\\\Swift\\\\CompileCommands-build)",
+ "command": ".*swiftc .* (\\")?.*(/Tests/RunCMake/Swift/E.swift|\\\\Tests\\\\RunCMake\\\\Swift\\\\E.swift)(\\")? (\\")?.*(/Tests/RunCMake/Swift/L.swift|\\\\Tests\\\\RunCMake\\\\Swift\\\\L.swift)(\\")?",
+ "file": ".*(/Tests/RunCMake/Swift/E.swift|\\\\Tests\\\\RunCMake\\\\Swift\\\\E.swift)",
+ "output": "CMakeFiles/CompileCommandLib.dir/E.swift.o|CMakeFiles\\\\CompileCommandLib.dir\\\\E.swift.obj"
+},
+{
+ "directory": ".*(/Tests/RunCMake/Swift/CompileCommands-build|\\\\Tests\\\\RunCMake\\\\Swift\\\\CompileCommands-build)",
+ "command": ".*swiftc .* (\\")?.*(/Tests/RunCMake/Swift/E.swift|\\\\Tests\\\\RunCMake\\\\Swift\\\\E.swift)(\\")? (\\")?.*(/Tests/RunCMake/Swift/L.swift|\\\\Tests\\\\RunCMake\\\\Swift\\\\L.swift)(\\")?",
+ "file": ".*/Tests/RunCMake/Swift/L.swift",
+ "output": "CMakeFiles/CompileCommandLib.dir/L.swift.o|CMakeFiles\\\\CompileCommandLib.dir\\\\L.swift.obj"
+}
+]$]==]
+)
+
+file(READ "${RunCMake_TEST_BINARY_DIR}/compile_commands.json" compile_commands)
+if(NOT compile_commands MATCHES "${expected_compile_commands}")
+ string(REPLACE "\n" "\n " expected_compile_commands_formatted "${expected_compile_commands}")
+ string(REPLACE "\n" "\n " compile_commands_formatted "${compile_commands}")
+ string(APPEND RunCMake_TEST_FAILED "Expected compile_commands.json to match:\n ${expected_compile_commands_formatted}\nActual compile_commands.json:\n ${compile_commands_formatted}\n")
+endif()
diff --git a/Tests/RunCMake/Swift/CompileCommands.cmake b/Tests/RunCMake/Swift/CompileCommands.cmake
new file mode 100644
index 0000000..f859693
--- /dev/null
+++ b/Tests/RunCMake/Swift/CompileCommands.cmake
@@ -0,0 +1,9 @@
+if(POLICY CMP0157)
+ cmake_policy(SET CMP0157 NEW)
+endif()
+set(CMAKE_Swift_COMPILATION_MODE "singlefile")
+
+enable_language(Swift)
+
+add_library(CompileCommandLib STATIC E.swift L.swift)
+set_target_properties(CompileCommandLib PROPERTIES EXPORT_COMPILE_COMMANDS YES)
diff --git a/Tests/RunCMake/Swift/ForceResponseFile-check-stdout.txt b/Tests/RunCMake/Swift/ForceResponseFile-check-stdout.txt
new file mode 100644
index 0000000..576f5a1
--- /dev/null
+++ b/Tests/RunCMake/Swift/ForceResponseFile-check-stdout.txt
@@ -0,0 +1,4 @@
+swiftc [^
+]* -c @CMakeFiles/L.dir/L.o.swift.rsp [^
+]*
+.*swiftc -emit-library -static -o libL.a @CMakeFiles/L.rsp.*
diff --git a/Tests/RunCMake/Swift/ForceResponseFile.cmake b/Tests/RunCMake/Swift/ForceResponseFile.cmake
new file mode 100644
index 0000000..7fd4636
--- /dev/null
+++ b/Tests/RunCMake/Swift/ForceResponseFile.cmake
@@ -0,0 +1,13 @@
+if(POLICY CMP0157)
+ cmake_policy(SET CMP0157 NEW)
+endif()
+
+if(NOT CMAKE_GENERATOR STREQUAL "Ninja")
+ message(SEND_ERROR "this test must use Ninja generator, found ${CMAKE_GENERATOR} ")
+endif()
+
+set(CMAKE_NINJA_FORCE_RESPONSE_FILE TRUE)
+
+enable_language(Swift)
+
+add_library(L STATIC L.swift)
diff --git a/Tests/RunCMake/Swift/NoWorkToDo-norelink-stdout.txt b/Tests/RunCMake/Swift/NoWorkToDo-norelink-stdout.txt
new file mode 100644
index 0000000..e7b31b7
--- /dev/null
+++ b/Tests/RunCMake/Swift/NoWorkToDo-norelink-stdout.txt
@@ -0,0 +1,2 @@
+.*\[1\/4\].*
+.*\[2\/3\].*
diff --git a/Tests/RunCMake/Swift/NoWorkToDo.cmake b/Tests/RunCMake/Swift/NoWorkToDo.cmake
index 02b9195..b58f8ff 100644
--- a/Tests/RunCMake/Swift/NoWorkToDo.cmake
+++ b/Tests/RunCMake/Swift/NoWorkToDo.cmake
@@ -1,6 +1,9 @@
cmake_policy(SET CMP0157 NEW)
enable_language(Swift)
-add_executable(hello1 hello.swift)
+
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/hello.swift "")
+
+add_executable(hello1 ${CMAKE_CURRENT_BINARY_DIR}/hello.swift)
set_target_properties(hello1 PROPERTIES ENABLE_EXPORTS TRUE)
-add_executable(hello2 hello.swift)
+add_executable(hello2 ${CMAKE_CURRENT_BINARY_DIR}/hello.swift)
diff --git a/Tests/RunCMake/Swift/RunCMakeTest.cmake b/Tests/RunCMake/Swift/RunCMakeTest.cmake
index 184b461..b5210c9 100644
--- a/Tests/RunCMake/Swift/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Swift/RunCMakeTest.cmake
@@ -27,6 +27,9 @@ elseif(RunCMake_GENERATOR STREQUAL Ninja)
set(RunCMake_TEST_OUTPUT_MERGE 1)
run_cmake_command(NoWorkToDo-build ${CMAKE_COMMAND} --build .)
run_cmake_command(NoWorkToDo-nowork ${CMAKE_COMMAND} --build . -- -d explain)
+ file(WRITE ${RunCMake_TEST_BINARY_DIR}/hello.swift "//No-op change\n")
+ run_cmake_command(NoWorkToDo-norelink ${CMAKE_COMMAND} --build . -- -d explain)
+ run_cmake_command(NoWorkToDo-nowork ${CMAKE_COMMAND} --build . -- -d explain)
endblock()
# Test that intermediate static libraries are rebuilt when the public
@@ -61,6 +64,24 @@ elseif(RunCMake_GENERATOR STREQUAL Ninja)
run_cmake(CMP0157-WARN)
endblock()
+ block()
+ set(CompileCommands_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CompileCommands-build)
+ run_cmake(CompileCommands)
+ run_cmake_command(CompileCommands-check ${CMAKE_COMMAND} --build ${CompileCommands_TEST_BINARY_DIR})
+ endblock()
+
+ block()
+ set(ForceResponseFile_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ForceResponseFile-build)
+ run_cmake(ForceResponseFile)
+ # -v: verbose to capture executed commands -n: dry-run to avoid actually compiling
+ run_cmake_command(ForceResponseFile-check ${CMAKE_COMMAND} --build ${ForceResponseFile_TEST_BINARY_DIR} -- -vn)
+ endblock()
+
+ block()
+ set(SwiftLibraryModuleCommand_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SwiftLibraryModuleCommand-build)
+ run_cmake(SwiftLibraryModuleCommand)
+ run_cmake_command(SwiftLibraryModuleCommand-check ${CMAKE_COMMAND} --build ${SwiftLibraryModuleCommand_TEST_BINARY_DIR} -- -n -v)
+ endblock()
endif()
elseif(RunCMake_GENERATOR STREQUAL "Ninja Multi-Config")
if(CMake_TEST_Swift)
diff --git a/Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout.txt b/Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout.txt
new file mode 100644
index 0000000..85767eb
--- /dev/null
+++ b/Tests/RunCMake/Swift/SwiftLibraryModuleCommand-check-stdout.txt
@@ -0,0 +1,3 @@
+.*swiftc(.exe)? .* -parse-as-library -static -emit-module .* -module-name StaticLibrary [^
+]*
+.*swiftc(.exe)? .* -parse-as-library -emit-module .* -module-name DynamicLibrary
diff --git a/Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake b/Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake
new file mode 100644
index 0000000..7127751
--- /dev/null
+++ b/Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake
@@ -0,0 +1,8 @@
+if(POLICY CMP0157)
+ cmake_policy(SET CMP0157 NEW)
+endif()
+
+enable_language(Swift)
+
+add_library(StaticLibrary STATIC L.swift)
+add_library(DynamicLibrary SHARED L.swift)
diff --git a/Tests/RunCMake/export/DependOnDoubleExport-stderr.txt b/Tests/RunCMake/export/DependOnDoubleExport-stderr.txt
index e8f8a09..a884939 100644
--- a/Tests/RunCMake/export/DependOnDoubleExport-stderr.txt
+++ b/Tests/RunCMake/export/DependOnDoubleExport-stderr.txt
@@ -1,7 +1,7 @@
CMake Error in CMakeLists.txt:
export called with target "exported" which requires target "doubleexported"
- that is not in this export set, but in multiple other export sets:
- .*/Tests/RunCMake/export/DependOnDoubleExport-build/exportset.cmake,
+ that is not in this export set, but in multiple other export sets:.*
+ .*/Tests/RunCMake/export/DependOnDoubleExport-build/exportset.cmake,.*
.*/Tests/RunCMake/export/DependOnDoubleExport-build/manual.cmake.
+
An exported target cannot depend upon another target which is exported
diff --git a/Utilities/Scripts/update-zlib.bash b/Utilities/Scripts/update-zlib.bash
index e29da88..5913150 100755
--- a/Utilities/Scripts/update-zlib.bash
+++ b/Utilities/Scripts/update-zlib.bash
@@ -8,7 +8,7 @@ readonly name="zlib"
readonly ownership="zlib upstream <kwrobot@kitware.com>"
readonly subtree="Utilities/cmzlib"
readonly repo="https://github.com/madler/zlib.git"
-readonly tag="v1.2.12"
+readonly tag="v1.2.13"
readonly shortlog=false
readonly paths="
README
diff --git a/Utilities/cmzlib/README b/Utilities/cmzlib/README
index 024b79d..ba34d18 100644
--- a/Utilities/cmzlib/README
+++ b/Utilities/cmzlib/README
@@ -1,6 +1,6 @@
ZLIB DATA COMPRESSION LIBRARY
-zlib 1.2.12 is a general purpose data compression library. All the code is
+zlib 1.2.13 is a general purpose data compression library. All the code is
thread safe. The data format used by the zlib library is described by RFCs
(Request for Comments) 1950 to 1952 in the files
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
@@ -31,7 +31,7 @@ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
issue of Dr. Dobb's Journal; a copy of the article is available at
http://marknelson.us/1997/01/01/zlib-engine/ .
-The changes made in version 1.2.12 are documented in the file ChangeLog.
+The changes made in version 1.2.13 are documented in the file ChangeLog.
Unsupported third party contributions are provided in directory contrib/ .
diff --git a/Utilities/cmzlib/compress.c b/Utilities/cmzlib/compress.c
index e2db404..2ad5326 100644
--- a/Utilities/cmzlib/compress.c
+++ b/Utilities/cmzlib/compress.c
@@ -19,7 +19,7 @@
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid.
*/
-int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
+int ZEXPORT compress2(dest, destLen, source, sourceLen, level)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
@@ -65,7 +65,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
/* ===========================================================================
*/
-int ZEXPORT compress (dest, destLen, source, sourceLen)
+int ZEXPORT compress(dest, destLen, source, sourceLen)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
@@ -78,7 +78,7 @@ int ZEXPORT compress (dest, destLen, source, sourceLen)
If the default memLevel or windowBits for deflateInit() is changed, then
this function needs to be updated.
*/
-uLong ZEXPORT compressBound (sourceLen)
+uLong ZEXPORT compressBound(sourceLen)
uLong sourceLen;
{
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
diff --git a/Utilities/cmzlib/crc32.c b/Utilities/cmzlib/crc32.c
index a1bdce5..f8357b0 100644
--- a/Utilities/cmzlib/crc32.c
+++ b/Utilities/cmzlib/crc32.c
@@ -98,13 +98,22 @@
# endif
#endif
+/* If available, use the ARM processor CRC32 instruction. */
+#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8
+# define ARMCRC32
+#endif
+
/* Local functions. */
local z_crc_t multmodp OF((z_crc_t a, z_crc_t b));
local z_crc_t x2nmodp OF((z_off64_t n, unsigned k));
-/* If available, use the ARM processor CRC32 instruction. */
-#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8
-# define ARMCRC32
+#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE))
+ local z_word_t byte_swap OF((z_word_t word));
+#endif
+
+#if defined(W) && !defined(ARMCRC32)
+ local z_crc_t crc_word OF((z_word_t data));
+ local z_word_t crc_word_big OF((z_word_t data));
#endif
#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE))
@@ -630,7 +639,7 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
#endif /* DYNAMIC_CRC_TABLE */
/* Pre-condition the CRC */
- crc ^= 0xffffffff;
+ crc = (~crc) & 0xffffffff;
/* Compute the CRC up to a word boundary. */
while (len && ((z_size_t)buf & 7) != 0) {
@@ -645,8 +654,8 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
len &= 7;
/* Do three interleaved CRCs to realize the throughput of one crc32x
- instruction per cycle. Each CRC is calcuated on Z_BATCH words. The three
- CRCs are combined into a single CRC after each set of batches. */
+ instruction per cycle. Each CRC is calculated on Z_BATCH words. The
+ three CRCs are combined into a single CRC after each set of batches. */
while (num >= 3 * Z_BATCH) {
crc1 = 0;
crc2 = 0;
@@ -749,7 +758,7 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
#endif /* DYNAMIC_CRC_TABLE */
/* Pre-condition the CRC */
- crc ^= 0xffffffff;
+ crc = (~crc) & 0xffffffff;
#ifdef W
@@ -1077,7 +1086,7 @@ uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
#ifdef DYNAMIC_CRC_TABLE
once(&made, make_crc_table);
#endif /* DYNAMIC_CRC_TABLE */
- return multmodp(x2nmodp(len2, 3), crc1) ^ crc2;
+ return multmodp(x2nmodp(len2, 3), crc1) ^ (crc2 & 0xffffffff);
}
/* ========================================================================= */
@@ -1086,7 +1095,7 @@ uLong ZEXPORT crc32_combine(crc1, crc2, len2)
uLong crc2;
z_off_t len2;
{
- return crc32_combine64(crc1, crc2, len2);
+ return crc32_combine64(crc1, crc2, (z_off64_t)len2);
}
/* ========================================================================= */
@@ -1103,14 +1112,14 @@ uLong ZEXPORT crc32_combine_gen64(len2)
uLong ZEXPORT crc32_combine_gen(len2)
z_off_t len2;
{
- return crc32_combine_gen64(len2);
+ return crc32_combine_gen64((z_off64_t)len2);
}
/* ========================================================================= */
-uLong crc32_combine_op(crc1, crc2, op)
+uLong ZEXPORT crc32_combine_op(crc1, crc2, op)
uLong crc1;
uLong crc2;
uLong op;
{
- return multmodp(op, crc1) ^ crc2;
+ return multmodp(op, crc1) ^ (crc2 & 0xffffffff);
}
diff --git a/Utilities/cmzlib/deflate.c b/Utilities/cmzlib/deflate.c
index 2032206..92ded86 100644
--- a/Utilities/cmzlib/deflate.c
+++ b/Utilities/cmzlib/deflate.c
@@ -52,7 +52,7 @@
#include "deflate.h"
const char deflate_copyright[] =
- " deflate 1.2.12 Copyright 1995-2022 Jean-loup Gailly and Mark Adler ";
+ " deflate 1.2.13 Copyright 1995-2022 Jean-loup Gailly and Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@@ -87,13 +87,7 @@ local void lm_init OF((deflate_state *s));
local void putShortMSB OF((deflate_state *s, uInt b));
local void flush_pending OF((z_streamp strm));
local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
-#ifdef ASMV
-# pragma message("Assembler code may have bugs -- use at your own risk")
- void match_init OF((void)); /* asm code initialization */
- uInt longest_match OF((deflate_state *s, IPos cur_match));
-#else
local uInt longest_match OF((deflate_state *s, IPos cur_match));
-#endif
#ifdef ZLIB_DEBUG
local void check_match OF((deflate_state *s, IPos start, IPos match,
@@ -160,7 +154,7 @@ local const config configuration_table[10] = {
* characters, so that a running hash key can be computed from the previous
* key instead of complete recalculation each time.
*/
-#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
+#define UPDATE_HASH(s,h,c) (h = (((h) << s->hash_shift) ^ (c)) & s->hash_mask)
/* ===========================================================================
@@ -191,9 +185,9 @@ local const config configuration_table[10] = {
*/
#define CLEAR_HASH(s) \
do { \
- s->head[s->hash_size-1] = NIL; \
+ s->head[s->hash_size - 1] = NIL; \
zmemzero((Bytef *)s->head, \
- (unsigned)(s->hash_size-1)*sizeof(*s->head)); \
+ (unsigned)(s->hash_size - 1)*sizeof(*s->head)); \
} while (0)
/* ===========================================================================
@@ -285,6 +279,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
if (windowBits < 0) { /* suppress zlib wrapper */
wrap = 0;
+ if (windowBits < -15)
+ return Z_STREAM_ERROR;
windowBits = -windowBits;
}
#ifdef GZIP
@@ -314,7 +310,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
s->hash_bits = (uInt)memLevel + 7;
s->hash_size = 1 << s->hash_bits;
s->hash_mask = s->hash_size - 1;
- s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
+ s->hash_shift = ((s->hash_bits + MIN_MATCH-1) / MIN_MATCH);
s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
@@ -347,11 +343,11 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
* sym_buf value to read moves forward three bytes. From that symbol, up to
* 31 bits are written to pending_buf. The closest the written pending_buf
* bits gets to the next sym_buf symbol to read is just before the last
- * code is written. At that time, 31*(n-2) bits have been written, just
- * after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at
- * 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1
+ * code is written. At that time, 31*(n - 2) bits have been written, just
+ * after 24*(n - 2) bits have been consumed from sym_buf. sym_buf starts at
+ * 8*n bits into pending_buf. (Note that the symbol buffer fills when n - 1
* symbols are written.) The closest the writing gets to what is unread is
- * then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and
+ * then n + 14 bits. Here n is lit_bufsize, which is 16384 by default, and
* can range from 128 to 32768.
*
* Therefore, at a minimum, there are 142 bits of space between what is
@@ -397,7 +393,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
/* =========================================================================
* Check for a valid deflate stream state. Return 0 if ok, 1 if not.
*/
-local int deflateStateCheck (strm)
+local int deflateStateCheck(strm)
z_streamp strm;
{
deflate_state *s;
@@ -420,7 +416,7 @@ local int deflateStateCheck (strm)
}
/* ========================================================================= */
-int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
+int ZEXPORT deflateSetDictionary(strm, dictionary, dictLength)
z_streamp strm;
const Bytef *dictionary;
uInt dictLength;
@@ -489,7 +485,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
}
/* ========================================================================= */
-int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength)
+int ZEXPORT deflateGetDictionary(strm, dictionary, dictLength)
z_streamp strm;
Bytef *dictionary;
uInt *dictLength;
@@ -511,7 +507,7 @@ int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength)
}
/* ========================================================================= */
-int ZEXPORT deflateResetKeep (strm)
+int ZEXPORT deflateResetKeep(strm)
z_streamp strm;
{
deflate_state *s;
@@ -549,7 +545,7 @@ int ZEXPORT deflateResetKeep (strm)
}
/* ========================================================================= */
-int ZEXPORT deflateReset (strm)
+int ZEXPORT deflateReset(strm)
z_streamp strm;
{
int ret;
@@ -561,7 +557,7 @@ int ZEXPORT deflateReset (strm)
}
/* ========================================================================= */
-int ZEXPORT deflateSetHeader (strm, head)
+int ZEXPORT deflateSetHeader(strm, head)
z_streamp strm;
gz_headerp head;
{
@@ -572,7 +568,7 @@ int ZEXPORT deflateSetHeader (strm, head)
}
/* ========================================================================= */
-int ZEXPORT deflatePending (strm, pending, bits)
+int ZEXPORT deflatePending(strm, pending, bits)
unsigned *pending;
int *bits;
z_streamp strm;
@@ -586,7 +582,7 @@ int ZEXPORT deflatePending (strm, pending, bits)
}
/* ========================================================================= */
-int ZEXPORT deflatePrime (strm, bits, value)
+int ZEXPORT deflatePrime(strm, bits, value)
z_streamp strm;
int bits;
int value;
@@ -681,36 +677,50 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
}
/* =========================================================================
- * For the default windowBits of 15 and memLevel of 8, this function returns
- * a close to exact, as well as small, upper bound on the compressed size.
- * They are coded as constants here for a reason--if the #define's are
- * changed, then this function needs to be changed as well. The return
- * value for 15 and 8 only works for those exact settings.
+ * For the default windowBits of 15 and memLevel of 8, this function returns a
+ * close to exact, as well as small, upper bound on the compressed size. This
+ * is an expansion of ~0.03%, plus a small constant.
+ *
+ * For any setting other than those defaults for windowBits and memLevel, one
+ * of two worst case bounds is returned. This is at most an expansion of ~4% or
+ * ~13%, plus a small constant.
*
- * For any setting other than those defaults for windowBits and memLevel,
- * the value returned is a conservative worst case for the maximum expansion
- * resulting from using fixed blocks instead of stored blocks, which deflate
- * can emit on compressed data for some combinations of the parameters.
+ * Both the 0.03% and 4% derive from the overhead of stored blocks. The first
+ * one is for stored blocks of 16383 bytes (memLevel == 8), whereas the second
+ * is for stored blocks of 127 bytes (the worst case memLevel == 1). The
+ * expansion results from five bytes of header for each stored block.
*
- * This function could be more sophisticated to provide closer upper bounds for
- * every combination of windowBits and memLevel. But even the conservative
- * upper bound of about 14% expansion does not seem onerous for output buffer
- * allocation.
+ * The larger expansion of 13% results from a window size less than or equal to
+ * the symbols buffer size (windowBits <= memLevel + 7). In that case some of
+ * the data being compressed may have slid out of the sliding window, impeding
+ * a stored block from being emitted. Then the only choice is a fixed or
+ * dynamic block, where a fixed block limits the maximum expansion to 9 bits
+ * per 8-bit byte, plus 10 bits for every block. The smallest block size for
+ * which this can occur is 255 (memLevel == 2).
+ *
+ * Shifts are used to approximate divisions, for speed.
*/
uLong ZEXPORT deflateBound(strm, sourceLen)
z_streamp strm;
uLong sourceLen;
{
deflate_state *s;
- uLong complen, wraplen;
+ uLong fixedlen, storelen, wraplen;
+
+ /* upper bound for fixed blocks with 9-bit literals and length 255
+ (memLevel == 2, which is the lowest that may not use stored blocks) --
+ ~13% overhead plus a small constant */
+ fixedlen = sourceLen + (sourceLen >> 3) + (sourceLen >> 8) +
+ (sourceLen >> 9) + 4;
- /* conservative upper bound for compressed data */
- complen = sourceLen +
- ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5;
+ /* upper bound for stored blocks with length 127 (memLevel == 1) --
+ ~4% overhead plus a small constant */
+ storelen = sourceLen + (sourceLen >> 5) + (sourceLen >> 7) +
+ (sourceLen >> 11) + 7;
- /* if can't get parameters, return conservative bound plus zlib wrapper */
+ /* if can't get parameters, return larger bound plus a zlib wrapper */
if (deflateStateCheck(strm))
- return complen + 6;
+ return (fixedlen > storelen ? fixedlen : storelen) + 6;
/* compute wrapper length */
s = strm->state;
@@ -747,11 +757,12 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
wraplen = 6;
}
- /* if not default parameters, return conservative bound */
+ /* if not default parameters, return one of the conservative bounds */
if (s->w_bits != 15 || s->hash_bits != 8 + 7)
- return complen + wraplen;
+ return (s->w_bits <= s->hash_bits ? fixedlen : storelen) + wraplen;
- /* default settings: return tight bound for that case */
+ /* default settings: return tight bound for that case -- ~0.03% overhead
+ plus a small constant */
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
(sourceLen >> 25) + 13 - 6 + wraplen;
}
@@ -761,7 +772,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
* IN assertion: the stream state is correct and there is enough room in
* pending_buf.
*/
-local void putShortMSB (s, b)
+local void putShortMSB(s, b)
deflate_state *s;
uInt b;
{
@@ -808,7 +819,7 @@ local void flush_pending(strm)
} while (0)
/* ========================================================================= */
-int ZEXPORT deflate (strm, flush)
+int ZEXPORT deflate(strm, flush)
z_streamp strm;
int flush;
{
@@ -863,7 +874,7 @@ int ZEXPORT deflate (strm, flush)
s->status = BUSY_STATE;
if (s->status == INIT_STATE) {
/* zlib header */
- uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
+ uInt header = (Z_DEFLATED + ((s->w_bits - 8) << 4)) << 8;
uInt level_flags;
if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
@@ -1123,7 +1134,7 @@ int ZEXPORT deflate (strm, flush)
}
/* ========================================================================= */
-int ZEXPORT deflateEnd (strm)
+int ZEXPORT deflateEnd(strm)
z_streamp strm;
{
int status;
@@ -1149,7 +1160,7 @@ int ZEXPORT deflateEnd (strm)
* To simplify the source, this is not supported for 16-bit MSDOS (which
* doesn't have enough memory anyway to duplicate compression states).
*/
-int ZEXPORT deflateCopy (dest, source)
+int ZEXPORT deflateCopy(dest, source)
z_streamp dest;
z_streamp source;
{
@@ -1238,7 +1249,7 @@ local unsigned read_buf(strm, buf, size)
/* ===========================================================================
* Initialize the "longest match" routines for a new zlib stream
*/
-local void lm_init (s)
+local void lm_init(s)
deflate_state *s;
{
s->window_size = (ulg)2L*s->w_size;
@@ -1259,11 +1270,6 @@ local void lm_init (s)
s->match_length = s->prev_length = MIN_MATCH-1;
s->match_available = 0;
s->ins_h = 0;
-#ifndef FASTEST
-#ifdef ASMV
- match_init(); /* initialize the asm code */
-#endif
-#endif
}
#ifndef FASTEST
@@ -1276,10 +1282,6 @@ local void lm_init (s)
* string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
* OUT assertion: the match length is not greater than s->lookahead.
*/
-#ifndef ASMV
-/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
- * match.S. The code will be functionally equivalent.
- */
local uInt longest_match(s, cur_match)
deflate_state *s;
IPos cur_match; /* current match */
@@ -1304,10 +1306,10 @@ local uInt longest_match(s, cur_match)
*/
register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
register ush scan_start = *(ushf*)scan;
- register ush scan_end = *(ushf*)(scan+best_len-1);
+ register ush scan_end = *(ushf*)(scan + best_len - 1);
#else
register Bytef *strend = s->window + s->strstart + MAX_MATCH;
- register Byte scan_end1 = scan[best_len-1];
+ register Byte scan_end1 = scan[best_len - 1];
register Byte scan_end = scan[best_len];
#endif
@@ -1325,7 +1327,8 @@ local uInt longest_match(s, cur_match)
*/
if ((uInt)nice_match > s->lookahead) nice_match = (int)s->lookahead;
- Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
+ Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
+ "need lookahead");
do {
Assert(cur_match < s->strstart, "no future");
@@ -1343,43 +1346,44 @@ local uInt longest_match(s, cur_match)
/* This code assumes sizeof(unsigned short) == 2. Do not use
* UNALIGNED_OK if your compiler uses a different size.
*/
- if (*(ushf*)(match+best_len-1) != scan_end ||
+ if (*(ushf*)(match + best_len - 1) != scan_end ||
*(ushf*)match != scan_start) continue;
/* It is not necessary to compare scan[2] and match[2] since they are
* always equal when the other bytes match, given that the hash keys
* are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
- * strstart+3, +5, ... up to strstart+257. We check for insufficient
+ * strstart + 3, + 5, up to strstart + 257. We check for insufficient
* lookahead only every 4th comparison; the 128th check will be made
- * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
+ * at strstart + 257. If MAX_MATCH-2 is not a multiple of 8, it is
* necessary to put more guard bytes at the end of the window, or
* to check more often for insufficient lookahead.
*/
Assert(scan[2] == match[2], "scan[2]?");
scan++, match++;
do {
- } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+ } while (*(ushf*)(scan += 2) == *(ushf*)(match += 2) &&
+ *(ushf*)(scan += 2) == *(ushf*)(match += 2) &&
+ *(ushf*)(scan += 2) == *(ushf*)(match += 2) &&
+ *(ushf*)(scan += 2) == *(ushf*)(match += 2) &&
scan < strend);
/* The funny "do {}" generates better code on most compilers */
- /* Here, scan <= window+strstart+257 */
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+ /* Here, scan <= window + strstart + 257 */
+ Assert(scan <= s->window + (unsigned)(s->window_size - 1),
+ "wild scan");
if (*scan == *match) scan++;
- len = (MAX_MATCH - 1) - (int)(strend-scan);
+ len = (MAX_MATCH - 1) - (int)(strend - scan);
scan = strend - (MAX_MATCH-1);
#else /* UNALIGNED_OK */
- if (match[best_len] != scan_end ||
- match[best_len-1] != scan_end1 ||
- *match != *scan ||
- *++match != scan[1]) continue;
+ if (match[best_len] != scan_end ||
+ match[best_len - 1] != scan_end1 ||
+ *match != *scan ||
+ *++match != scan[1]) continue;
- /* The check at best_len-1 can be removed because it will be made
+ /* The check at best_len - 1 can be removed because it will be made
* again later. (This heuristic is not always a win.)
* It is not necessary to compare scan[2] and match[2] since they
* are always equal when the other bytes match, given that
@@ -1389,7 +1393,7 @@ local uInt longest_match(s, cur_match)
Assert(*scan == *match, "match[2]?");
/* We check for insufficient lookahead only every 8th comparison;
- * the 256th check will be made at strstart+258.
+ * the 256th check will be made at strstart + 258.
*/
do {
} while (*++scan == *++match && *++scan == *++match &&
@@ -1398,7 +1402,8 @@ local uInt longest_match(s, cur_match)
*++scan == *++match && *++scan == *++match &&
scan < strend);
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+ Assert(scan <= s->window + (unsigned)(s->window_size - 1),
+ "wild scan");
len = MAX_MATCH - (int)(strend - scan);
scan = strend - MAX_MATCH;
@@ -1410,9 +1415,9 @@ local uInt longest_match(s, cur_match)
best_len = len;
if (len >= nice_match) break;
#ifdef UNALIGNED_OK
- scan_end = *(ushf*)(scan+best_len-1);
+ scan_end = *(ushf*)(scan + best_len - 1);
#else
- scan_end1 = scan[best_len-1];
+ scan_end1 = scan[best_len - 1];
scan_end = scan[best_len];
#endif
}
@@ -1422,7 +1427,6 @@ local uInt longest_match(s, cur_match)
if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
return s->lookahead;
}
-#endif /* ASMV */
#else /* FASTEST */
@@ -1443,7 +1447,8 @@ local uInt longest_match(s, cur_match)
*/
Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
- Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
+ Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
+ "need lookahead");
Assert(cur_match < s->strstart, "no future");
@@ -1453,7 +1458,7 @@ local uInt longest_match(s, cur_match)
*/
if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
- /* The check at best_len-1 can be removed because it will be made
+ /* The check at best_len - 1 can be removed because it will be made
* again later. (This heuristic is not always a win.)
* It is not necessary to compare scan[2] and match[2] since they
* are always equal when the other bytes match, given that
@@ -1463,7 +1468,7 @@ local uInt longest_match(s, cur_match)
Assert(*scan == *match, "match[2]?");
/* We check for insufficient lookahead only every 8th comparison;
- * the 256th check will be made at strstart+258.
+ * the 256th check will be made at strstart + 258.
*/
do {
} while (*++scan == *++match && *++scan == *++match &&
@@ -1472,7 +1477,7 @@ local uInt longest_match(s, cur_match)
*++scan == *++match && *++scan == *++match &&
scan < strend);
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+ Assert(scan <= s->window + (unsigned)(s->window_size - 1), "wild scan");
len = MAX_MATCH - (int)(strend - scan);
@@ -1508,7 +1513,7 @@ local void check_match(s, start, match, length)
z_error("invalid match");
}
if (z_verbose > 1) {
- fprintf(stderr,"\\[%d,%d]", start-match, length);
+ fprintf(stderr,"\\[%d,%d]", start - match, length);
do { putc(s->window[start++], stderr); } while (--length != 0);
}
}
@@ -1554,9 +1559,9 @@ local void fill_window(s)
/* If the window is almost full and there is insufficient lookahead,
* move the upper half to the lower one to make room in the upper half.
*/
- if (s->strstart >= wsize+MAX_DIST(s)) {
+ if (s->strstart >= wsize + MAX_DIST(s)) {
- zmemcpy(s->window, s->window+wsize, (unsigned)wsize - more);
+ zmemcpy(s->window, s->window + wsize, (unsigned)wsize - more);
s->match_start -= wsize;
s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
s->block_start -= (long) wsize;
@@ -1687,7 +1692,7 @@ local void fill_window(s)
*
* deflate_stored() is written to minimize the number of times an input byte is
* copied. It is most efficient with large input and output buffers, which
- * maximizes the opportunites to have a single copy from next_in to next_out.
+ * maximizes the opportunities to have a single copy from next_in to next_out.
*/
local block_state deflate_stored(s, flush)
deflate_state *s;
@@ -1897,7 +1902,7 @@ local block_state deflate_fast(s, flush)
if (s->lookahead == 0) break; /* flush the current block */
}
- /* Insert the string window[strstart .. strstart+2] in the
+ /* Insert the string window[strstart .. strstart + 2] in the
* dictionary, and set hash_head to the head of the hash chain:
*/
hash_head = NIL;
@@ -1945,7 +1950,7 @@ local block_state deflate_fast(s, flush)
s->strstart += s->match_length;
s->match_length = 0;
s->ins_h = s->window[s->strstart];
- UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
+ UPDATE_HASH(s, s->ins_h, s->window[s->strstart + 1]);
#if MIN_MATCH != 3
Call UPDATE_HASH() MIN_MATCH-3 more times
#endif
@@ -1956,7 +1961,7 @@ local block_state deflate_fast(s, flush)
} else {
/* No match, output a literal byte */
Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
+ _tr_tally_lit(s, s->window[s->strstart], bflush);
s->lookahead--;
s->strstart++;
}
@@ -2000,7 +2005,7 @@ local block_state deflate_slow(s, flush)
if (s->lookahead == 0) break; /* flush the current block */
}
- /* Insert the string window[strstart .. strstart+2] in the
+ /* Insert the string window[strstart .. strstart + 2] in the
* dictionary, and set hash_head to the head of the hash chain:
*/
hash_head = NIL;
@@ -2042,17 +2047,17 @@ local block_state deflate_slow(s, flush)
uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
/* Do not insert strings in hash table beyond this. */
- check_match(s, s->strstart-1, s->prev_match, s->prev_length);
+ check_match(s, s->strstart - 1, s->prev_match, s->prev_length);
- _tr_tally_dist(s, s->strstart -1 - s->prev_match,
+ _tr_tally_dist(s, s->strstart - 1 - s->prev_match,
s->prev_length - MIN_MATCH, bflush);
/* Insert in hash table all strings up to the end of the match.
- * strstart-1 and strstart are already inserted. If there is not
+ * strstart - 1 and strstart are already inserted. If there is not
* enough lookahead, the last two strings are not inserted in
* the hash table.
*/
- s->lookahead -= s->prev_length-1;
+ s->lookahead -= s->prev_length - 1;
s->prev_length -= 2;
do {
if (++s->strstart <= max_insert) {
@@ -2070,8 +2075,8 @@ local block_state deflate_slow(s, flush)
* single literal. If there was a match but the current match
* is longer, truncate the previous match to a single literal.
*/
- Tracevv((stderr,"%c", s->window[s->strstart-1]));
- _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+ Tracevv((stderr,"%c", s->window[s->strstart - 1]));
+ _tr_tally_lit(s, s->window[s->strstart - 1], bflush);
if (bflush) {
FLUSH_BLOCK_ONLY(s, 0);
}
@@ -2089,8 +2094,8 @@ local block_state deflate_slow(s, flush)
}
Assert (flush != Z_NO_FLUSH, "no flush?");
if (s->match_available) {
- Tracevv((stderr,"%c", s->window[s->strstart-1]));
- _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+ Tracevv((stderr,"%c", s->window[s->strstart - 1]));
+ _tr_tally_lit(s, s->window[s->strstart - 1], bflush);
s->match_available = 0;
}
s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
@@ -2147,7 +2152,8 @@ local block_state deflate_rle(s, flush)
if (s->match_length > s->lookahead)
s->match_length = s->lookahead;
}
- Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
+ Assert(scan <= s->window + (uInt)(s->window_size - 1),
+ "wild scan");
}
/* Emit match if have run of MIN_MATCH or longer, else emit literal */
@@ -2162,7 +2168,7 @@ local block_state deflate_rle(s, flush)
} else {
/* No match, output a literal byte */
Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
+ _tr_tally_lit(s, s->window[s->strstart], bflush);
s->lookahead--;
s->strstart++;
}
@@ -2202,7 +2208,7 @@ local block_state deflate_huff(s, flush)
/* Output a literal byte */
s->match_length = 0;
Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
+ _tr_tally_lit(s, s->window[s->strstart], bflush);
s->lookahead--;
s->strstart++;
if (bflush) FLUSH_BLOCK(s, 0);
diff --git a/Utilities/cmzlib/deflate.h b/Utilities/cmzlib/deflate.h
index 17c2261..1a06cd5 100644
--- a/Utilities/cmzlib/deflate.h
+++ b/Utilities/cmzlib/deflate.h
@@ -329,8 +329,8 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
# define _tr_tally_dist(s, distance, length, flush) \
{ uch len = (uch)(length); \
ush dist = (ush)(distance); \
- s->sym_buf[s->sym_next++] = dist; \
- s->sym_buf[s->sym_next++] = dist >> 8; \
+ s->sym_buf[s->sym_next++] = (uch)dist; \
+ s->sym_buf[s->sym_next++] = (uch)(dist >> 8); \
s->sym_buf[s->sym_next++] = len; \
dist--; \
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
diff --git a/Utilities/cmzlib/gzlib.c b/Utilities/cmzlib/gzlib.c
index dddaf26..55da46a 100644
--- a/Utilities/cmzlib/gzlib.c
+++ b/Utilities/cmzlib/gzlib.c
@@ -30,7 +30,7 @@ local gzFile gz_open OF((const void *, int, const char *));
The gz_strwinerror function does not change the current setting of
GetLastError. */
-char ZLIB_INTERNAL *gz_strwinerror (error)
+char ZLIB_INTERNAL *gz_strwinerror(error)
DWORD error;
{
static char buf[1024];
diff --git a/Utilities/cmzlib/gzread.c b/Utilities/cmzlib/gzread.c
index e3519e6..eaa5523 100644
--- a/Utilities/cmzlib/gzread.c
+++ b/Utilities/cmzlib/gzread.c
@@ -157,11 +157,9 @@ local int gz_look(state)
the output buffer is larger than the input buffer, which also assures
space for gzungetc() */
state->x.next = state->out;
- if (strm->avail_in) {
- memcpy(state->x.next, strm->next_in, strm->avail_in);
- state->x.have = strm->avail_in;
- strm->avail_in = 0;
- }
+ memcpy(state->x.next, strm->next_in, strm->avail_in);
+ state->x.have = strm->avail_in;
+ strm->avail_in = 0;
state->how = COPY;
state->direct = 1;
return 0;
diff --git a/Utilities/cmzlib/gzwrite.c b/Utilities/cmzlib/gzwrite.c
index 33f4949..16d4a22 100644
--- a/Utilities/cmzlib/gzwrite.c
+++ b/Utilities/cmzlib/gzwrite.c
@@ -480,7 +480,7 @@ int ZEXPORTVA gzprintf(gzFile file, const char *format, ...)
#else /* !STDC && !Z_HAVE_STDARG_H */
/* -- see zlib.h -- */
-int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
+int ZEXPORTVA gzprintf(file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
gzFile file;
const char *format;
diff --git a/Utilities/cmzlib/inflate.c b/Utilities/cmzlib/inflate.c
index 7be8c63..8acbef4 100644
--- a/Utilities/cmzlib/inflate.c
+++ b/Utilities/cmzlib/inflate.c
@@ -168,6 +168,8 @@ int windowBits;
/* extract wrap request from windowBits parameter */
if (windowBits < 0) {
+ if (windowBits < -15)
+ return Z_STREAM_ERROR;
wrap = 0;
windowBits = -windowBits;
}
@@ -764,8 +766,9 @@ int flush;
if (copy > have) copy = have;
if (copy) {
if (state->head != Z_NULL &&
- state->head->extra != Z_NULL) {
- len = state->head->extra_len - state->length;
+ state->head->extra != Z_NULL &&
+ (len = state->head->extra_len - state->length) <
+ state->head->extra_max) {
zmemcpy(state->head->extra + len, next,
len + copy > state->head->extra_max ?
state->head->extra_max - len : copy);
diff --git a/Utilities/cmzlib/inftrees.c b/Utilities/cmzlib/inftrees.c
index 09462a7..57d2793 100644
--- a/Utilities/cmzlib/inftrees.c
+++ b/Utilities/cmzlib/inftrees.c
@@ -9,7 +9,7 @@
#define MAXBITS 15
const char inflate_copyright[] =
- " inflate 1.2.12 Copyright 1995-2022 Mark Adler ";
+ " inflate 1.2.13 Copyright 1995-2022 Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@@ -62,7 +62,7 @@ unsigned short FAR *work;
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
- 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 199, 202};
+ 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 194, 65};
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
diff --git a/Utilities/cmzlib/inftrees.h b/Utilities/cmzlib/inftrees.h
index baa53a0..f536653 100644
--- a/Utilities/cmzlib/inftrees.h
+++ b/Utilities/cmzlib/inftrees.h
@@ -38,7 +38,7 @@ typedef struct {
/* Maximum size of the dynamic table. The maximum number of code structures is
1444, which is the sum of 852 for literal/length codes and 592 for distance
codes. These values were found by exhaustive searches using the program
- examples/enough.c found in the zlib distribtution. The arguments to that
+ examples/enough.c found in the zlib distribution. The arguments to that
program are the number of symbols, the initial root table size, and the
maximum bit length of a code. "enough 286 9 15" for literal/length codes
returns returns 852, and "enough 30 6 15" for distance codes returns 592.
diff --git a/Utilities/cmzlib/trees.c b/Utilities/cmzlib/trees.c
index f73fd99..5f305c4 100644
--- a/Utilities/cmzlib/trees.c
+++ b/Utilities/cmzlib/trees.c
@@ -193,7 +193,7 @@ local void send_bits(s, value, length)
s->bits_sent += (ulg)length;
/* If not enough room in bi_buf, use (valid) bits from bi_buf and
- * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
+ * (16 - bi_valid) bits from value, leaving (width - (16 - bi_valid))
* unused bits in value.
*/
if (s->bi_valid > (int)Buf_size - length) {
@@ -256,7 +256,7 @@ local void tr_static_init()
length = 0;
for (code = 0; code < LENGTH_CODES-1; code++) {
base_length[code] = length;
- for (n = 0; n < (1<<extra_lbits[code]); n++) {
+ for (n = 0; n < (1 << extra_lbits[code]); n++) {
_length_code[length++] = (uch)code;
}
}
@@ -265,13 +265,13 @@ local void tr_static_init()
* in two different ways: code 284 + 5 bits or code 285, so we
* overwrite length_code[255] to use the best encoding:
*/
- _length_code[length-1] = (uch)code;
+ _length_code[length - 1] = (uch)code;
/* Initialize the mapping dist (0..32K) -> dist code (0..29) */
dist = 0;
for (code = 0 ; code < 16; code++) {
base_dist[code] = dist;
- for (n = 0; n < (1<<extra_dbits[code]); n++) {
+ for (n = 0; n < (1 << extra_dbits[code]); n++) {
_dist_code[dist++] = (uch)code;
}
}
@@ -279,11 +279,11 @@ local void tr_static_init()
dist >>= 7; /* from now on, all distances are divided by 128 */
for ( ; code < D_CODES; code++) {
base_dist[code] = dist << 7;
- for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
+ for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {
_dist_code[256 + dist++] = (uch)code;
}
}
- Assert (dist == 256, "tr_static_init: 256+dist != 512");
+ Assert (dist == 256, "tr_static_init: 256 + dist != 512");
/* Construct the codes of the static literal tree */
for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
@@ -312,7 +312,7 @@ local void tr_static_init()
}
/* ===========================================================================
- * Genererate the file trees.h describing the static trees.
+ * Generate the file trees.h describing the static trees.
*/
#ifdef GEN_TREES_H
# ifndef ZLIB_DEBUG
@@ -321,7 +321,7 @@ local void tr_static_init()
# define SEPARATOR(i, last, width) \
((i) == (last)? "\n};\n\n" : \
- ((i) % (width) == (width)-1 ? ",\n" : ", "))
+ ((i) % (width) == (width) - 1 ? ",\n" : ", "))
void gen_trees_header()
{
@@ -458,7 +458,7 @@ local void pqdownheap(s, tree, k)
while (j <= s->heap_len) {
/* Set j to the smallest of the two sons: */
if (j < s->heap_len &&
- smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
+ smaller(tree, s->heap[j + 1], s->heap[j], s->depth)) {
j++;
}
/* Exit if v is smaller than both sons */
@@ -507,7 +507,7 @@ local void gen_bitlen(s, desc)
*/
tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
- for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
+ for (h = s->heap_max + 1; h < HEAP_SIZE; h++) {
n = s->heap[h];
bits = tree[tree[n].Dad].Len + 1;
if (bits > max_length) bits = max_length, overflow++;
@@ -518,7 +518,7 @@ local void gen_bitlen(s, desc)
s->bl_count[bits]++;
xbits = 0;
- if (n >= base) xbits = extra[n-base];
+ if (n >= base) xbits = extra[n - base];
f = tree[n].Freq;
s->opt_len += (ulg)f * (unsigned)(bits + xbits);
if (stree) s->static_len += (ulg)f * (unsigned)(stree[n].Len + xbits);
@@ -530,10 +530,10 @@ local void gen_bitlen(s, desc)
/* Find the first bit length which could increase: */
do {
- bits = max_length-1;
+ bits = max_length - 1;
while (s->bl_count[bits] == 0) bits--;
- s->bl_count[bits]--; /* move one leaf down the tree */
- s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
+ s->bl_count[bits]--; /* move one leaf down the tree */
+ s->bl_count[bits + 1] += 2; /* move one overflow item as its brother */
s->bl_count[max_length]--;
/* The brother of the overflow item also moves one step up,
* but this does not affect bl_count[max_length]
@@ -569,7 +569,7 @@ local void gen_bitlen(s, desc)
* OUT assertion: the field code is set for all tree elements of non
* zero code length.
*/
-local void gen_codes (tree, max_code, bl_count)
+local void gen_codes(tree, max_code, bl_count)
ct_data *tree; /* the tree to decorate */
int max_code; /* largest code with non zero frequency */
ushf *bl_count; /* number of codes at each bit length */
@@ -583,13 +583,13 @@ local void gen_codes (tree, max_code, bl_count)
* without bit reversal.
*/
for (bits = 1; bits <= MAX_BITS; bits++) {
- code = (code + bl_count[bits-1]) << 1;
+ code = (code + bl_count[bits - 1]) << 1;
next_code[bits] = (ush)code;
}
/* Check that the bit counts in bl_count are consistent. The last code
* must be all ones.
*/
- Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
+ Assert (code + bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1,
"inconsistent bit counts");
Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
@@ -600,7 +600,7 @@ local void gen_codes (tree, max_code, bl_count)
tree[n].Code = (ush)bi_reverse(next_code[len]++, len);
Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
- n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
+ n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len] - 1));
}
}
@@ -624,7 +624,7 @@ local void build_tree(s, desc)
int node; /* new node being created */
/* Construct the initial heap, with least frequent element in
- * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
+ * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n + 1].
* heap[0] is not used.
*/
s->heap_len = 0, s->heap_max = HEAP_SIZE;
@@ -652,7 +652,7 @@ local void build_tree(s, desc)
}
desc->max_code = max_code;
- /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
+ /* The elements heap[heap_len/2 + 1 .. heap_len] are leaves of the tree,
* establish sub-heaps of increasing lengths:
*/
for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
@@ -700,7 +700,7 @@ local void build_tree(s, desc)
* Scan a literal or distance tree to determine the frequencies of the codes
* in the bit length tree.
*/
-local void scan_tree (s, tree, max_code)
+local void scan_tree(s, tree, max_code)
deflate_state *s;
ct_data *tree; /* the tree to be scanned */
int max_code; /* and its largest code of non zero frequency */
@@ -714,10 +714,10 @@ local void scan_tree (s, tree, max_code)
int min_count = 4; /* min repeat count */
if (nextlen == 0) max_count = 138, min_count = 3;
- tree[max_code+1].Len = (ush)0xffff; /* guard */
+ tree[max_code + 1].Len = (ush)0xffff; /* guard */
for (n = 0; n <= max_code; n++) {
- curlen = nextlen; nextlen = tree[n+1].Len;
+ curlen = nextlen; nextlen = tree[n + 1].Len;
if (++count < max_count && curlen == nextlen) {
continue;
} else if (count < min_count) {
@@ -745,7 +745,7 @@ local void scan_tree (s, tree, max_code)
* Send a literal or distance tree in compressed form, using the codes in
* bl_tree.
*/
-local void send_tree (s, tree, max_code)
+local void send_tree(s, tree, max_code)
deflate_state *s;
ct_data *tree; /* the tree to be scanned */
int max_code; /* and its largest code of non zero frequency */
@@ -758,11 +758,11 @@ local void send_tree (s, tree, max_code)
int max_count = 7; /* max repeat count */
int min_count = 4; /* min repeat count */
- /* tree[max_code+1].Len = -1; */ /* guard already set */
+ /* tree[max_code + 1].Len = -1; */ /* guard already set */
if (nextlen == 0) max_count = 138, min_count = 3;
for (n = 0; n <= max_code; n++) {
- curlen = nextlen; nextlen = tree[n+1].Len;
+ curlen = nextlen; nextlen = tree[n + 1].Len;
if (++count < max_count && curlen == nextlen) {
continue;
} else if (count < min_count) {
@@ -773,13 +773,13 @@ local void send_tree (s, tree, max_code)
send_code(s, curlen, s->bl_tree); count--;
}
Assert(count >= 3 && count <= 6, " 3_6?");
- send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
+ send_code(s, REP_3_6, s->bl_tree); send_bits(s, count - 3, 2);
} else if (count <= 10) {
- send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
+ send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count - 3, 3);
} else {
- send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
+ send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count - 11, 7);
}
count = 0; prevlen = curlen;
if (nextlen == 0) {
@@ -807,8 +807,8 @@ local int build_bl_tree(s)
/* Build the bit length tree: */
build_tree(s, (tree_desc *)(&(s->bl_desc)));
- /* opt_len now includes the length of the tree representations, except
- * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
+ /* opt_len now includes the length of the tree representations, except the
+ * lengths of the bit lengths codes and the 5 + 5 + 4 bits for the counts.
*/
/* Determine the number of bit length codes to send. The pkzip format
@@ -819,7 +819,7 @@ local int build_bl_tree(s)
if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
}
/* Update opt_len to include the bit length tree and counts */
- s->opt_len += 3*((ulg)max_blindex+1) + 5+5+4;
+ s->opt_len += 3*((ulg)max_blindex + 1) + 5 + 5 + 4;
Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
s->opt_len, s->static_len));
@@ -841,19 +841,19 @@ local void send_all_trees(s, lcodes, dcodes, blcodes)
Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
"too many codes");
Tracev((stderr, "\nbl counts: "));
- send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
- send_bits(s, dcodes-1, 5);
- send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
+ send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */
+ send_bits(s, dcodes - 1, 5);
+ send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */
for (rank = 0; rank < blcodes; rank++) {
Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
}
Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
- send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
+ send_tree(s, (ct_data *)s->dyn_ltree, lcodes - 1); /* literal tree */
Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
- send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
+ send_tree(s, (ct_data *)s->dyn_dtree, dcodes - 1); /* distance tree */
Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
}
@@ -866,7 +866,7 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
ulg stored_len; /* length of input block */
int last; /* one if this is the last block for a file */
{
- send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */
+ send_bits(s, (STORED_BLOCK<<1) + last, 3); /* send block type */
bi_windup(s); /* align on byte boundary */
put_short(s, (ush)stored_len);
put_short(s, (ush)~stored_len);
@@ -877,7 +877,7 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
s->compressed_len += (stored_len + 4) << 3;
s->bits_sent += 2*16;
- s->bits_sent += stored_len<<3;
+ s->bits_sent += stored_len << 3;
#endif
}
@@ -943,14 +943,17 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
max_blindex = build_bl_tree(s);
/* Determine the best encoding. Compute the block lengths in bytes. */
- opt_lenb = (s->opt_len+3+7)>>3;
- static_lenb = (s->static_len+3+7)>>3;
+ opt_lenb = (s->opt_len + 3 + 7) >> 3;
+ static_lenb = (s->static_len + 3 + 7) >> 3;
Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
s->sym_next / 3));
- if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
+#ifndef FORCE_STATIC
+ if (static_lenb <= opt_lenb || s->strategy == Z_FIXED)
+#endif
+ opt_lenb = static_lenb;
} else {
Assert(buf != (char*)0, "lost buf");
@@ -960,7 +963,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
#ifdef FORCE_STORED
if (buf != (char*)0) { /* force stored block */
#else
- if (stored_len+4 <= opt_lenb && buf != (char*)0) {
+ if (stored_len + 4 <= opt_lenb && buf != (char*)0) {
/* 4: two words for the lengths */
#endif
/* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
@@ -971,21 +974,17 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
*/
_tr_stored_block(s, buf, stored_len, last);
-#ifdef FORCE_STATIC
- } else if (static_lenb >= 0) { /* force static trees */
-#else
- } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
-#endif
- send_bits(s, (STATIC_TREES<<1)+last, 3);
+ } else if (static_lenb == opt_lenb) {
+ send_bits(s, (STATIC_TREES<<1) + last, 3);
compress_block(s, (const ct_data *)static_ltree,
(const ct_data *)static_dtree);
#ifdef ZLIB_DEBUG
s->compressed_len += 3 + s->static_len;
#endif
} else {
- send_bits(s, (DYN_TREES<<1)+last, 3);
- send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
- max_blindex+1);
+ send_bits(s, (DYN_TREES<<1) + last, 3);
+ send_all_trees(s, s->l_desc.max_code + 1, s->d_desc.max_code + 1,
+ max_blindex + 1);
compress_block(s, (const ct_data *)s->dyn_ltree,
(const ct_data *)s->dyn_dtree);
#ifdef ZLIB_DEBUG
@@ -1004,22 +1003,22 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
s->compressed_len += 7; /* align on byte boundary */
#endif
}
- Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
- s->compressed_len-7*last));
+ Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len >> 3,
+ s->compressed_len - 7*last));
}
/* ===========================================================================
* Save the match info and tally the frequency counts. Return true if
* the current block must be flushed.
*/
-int ZLIB_INTERNAL _tr_tally (s, dist, lc)
+int ZLIB_INTERNAL _tr_tally(s, dist, lc)
deflate_state *s;
unsigned dist; /* distance of matched string */
- unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
+ unsigned lc; /* match length - MIN_MATCH or unmatched char (dist==0) */
{
- s->sym_buf[s->sym_next++] = dist;
- s->sym_buf[s->sym_next++] = dist >> 8;
- s->sym_buf[s->sym_next++] = lc;
+ s->sym_buf[s->sym_next++] = (uch)dist;
+ s->sym_buf[s->sym_next++] = (uch)(dist >> 8);
+ s->sym_buf[s->sym_next++] = (uch)lc;
if (dist == 0) {
/* lc is the unmatched char */
s->dyn_ltree[lc].Freq++;
@@ -1031,7 +1030,7 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
(ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
(ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
- s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
+ s->dyn_ltree[_length_code[lc] + LITERALS + 1].Freq++;
s->dyn_dtree[d_code(dist)].Freq++;
}
return (s->sym_next == s->sym_end);
@@ -1061,7 +1060,7 @@ local void compress_block(s, ltree, dtree)
} else {
/* Here, lc is the match length - MIN_MATCH */
code = _length_code[lc];
- send_code(s, code+LITERALS+1, ltree); /* send the length code */
+ send_code(s, code + LITERALS + 1, ltree); /* send length code */
extra = extra_lbits[code];
if (extra != 0) {
lc -= base_length[code];
@@ -1177,6 +1176,6 @@ local void bi_windup(s)
s->bi_buf = 0;
s->bi_valid = 0;
#ifdef ZLIB_DEBUG
- s->bits_sent = (s->bits_sent+7) & ~7;
+ s->bits_sent = (s->bits_sent + 7) & ~7;
#endif
}
diff --git a/Utilities/cmzlib/uncompr.c b/Utilities/cmzlib/uncompr.c
index f03a1a8..f9532f4 100644
--- a/Utilities/cmzlib/uncompr.c
+++ b/Utilities/cmzlib/uncompr.c
@@ -24,7 +24,7 @@
Z_DATA_ERROR if the input data was corrupted, including if the input data is
an incomplete zlib stream.
*/
-int ZEXPORT uncompress2 (dest, destLen, source, sourceLen)
+int ZEXPORT uncompress2(dest, destLen, source, sourceLen)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
@@ -83,7 +83,7 @@ int ZEXPORT uncompress2 (dest, destLen, source, sourceLen)
err;
}
-int ZEXPORT uncompress (dest, destLen, source, sourceLen)
+int ZEXPORT uncompress(dest, destLen, source, sourceLen)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
diff --git a/Utilities/cmzlib/zconf.h b/Utilities/cmzlib/zconf.h
index 1790072..fe4ec59 100644
--- a/Utilities/cmzlib/zconf.h
+++ b/Utilities/cmzlib/zconf.h
@@ -40,6 +40,9 @@
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
+# define crc32_combine_gen z_crc32_combine_gen
+# define crc32_combine_gen64 z_crc32_combine_gen64
+# define crc32_combine_op z_crc32_combine_op
# define crc32_z z_crc32_z
# define deflate z_deflate
# define deflateBound z_deflateBound
@@ -351,6 +354,9 @@
# ifdef FAR
# undef FAR
# endif
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
@@ -469,11 +475,18 @@ typedef uLong FAR uLongf;
# undef _LARGEFILE64_SOURCE
#endif
-#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
-# define Z_HAVE_UNISTD_H
+#ifndef Z_HAVE_UNISTD_H
+# ifdef __WATCOMC__
+# define Z_HAVE_UNISTD_H
+# endif
+#endif
+#ifndef Z_HAVE_UNISTD_H
+# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32)
+# define Z_HAVE_UNISTD_H
+# endif
#endif
#ifndef Z_SOLO
-# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
+# if defined(Z_HAVE_UNISTD_H)
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
# ifdef VMS
# include <unixio.h> /* for off_t */
diff --git a/Utilities/cmzlib/zlib.h b/Utilities/cmzlib/zlib.h
index 3764e85..808ae68 100644
--- a/Utilities/cmzlib/zlib.h
+++ b/Utilities/cmzlib/zlib.h
@@ -1,5 +1,5 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library
- version 1.2.12, March 11th, 2022
+ version 1.2.13, October 13th, 2022
Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
@@ -37,11 +37,11 @@
extern "C" {
#endif
-#define ZLIB_VERSION "1.2.12"
-#define ZLIB_VERNUM 0x12c0
+#define ZLIB_VERSION "1.2.13"
+#define ZLIB_VERNUM 0x12d0
#define ZLIB_VER_MAJOR 1
#define ZLIB_VER_MINOR 2
-#define ZLIB_VER_REVISION 12
+#define ZLIB_VER_REVISION 13
#define ZLIB_VER_SUBREVISION 0
/*
@@ -276,7 +276,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
== 0), or after each call of deflate(). If deflate returns Z_OK and with
zero avail_out, it must be called again after making room in the output
buffer because there might be more output pending. See deflatePending(),
- which can be used if desired to determine whether or not there is more ouput
+ which can be used if desired to determine whether or not there is more output
in that case.
Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
@@ -660,7 +660,7 @@ ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm,
to dictionary. dictionary must have enough space, where 32768 bytes is
always enough. If deflateGetDictionary() is called with dictionary equal to
Z_NULL, then only the dictionary length is returned, and nothing is copied.
- Similary, if dictLength is Z_NULL, then it is not set.
+ Similarly, if dictLength is Z_NULL, then it is not set.
deflateGetDictionary() may return a length less than the window size, even
when more than the window size in input has been provided. It may return up
@@ -915,7 +915,7 @@ ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm,
to dictionary. dictionary must have enough space, where 32768 bytes is
always enough. If inflateGetDictionary() is called with dictionary equal to
Z_NULL, then only the dictionary length is returned, and nothing is copied.
- Similary, if dictLength is Z_NULL, then it is not set.
+ Similarly, if dictLength is Z_NULL, then it is not set.
inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
stream state is inconsistent.
@@ -1437,12 +1437,12 @@ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
In the event that the end of file is reached and only a partial item is
available at the end, i.e. the remaining uncompressed data length is not a
- multiple of size, then the final partial item is nevetheless read into buf
+ multiple of size, then the final partial item is nevertheless read into buf
and the end-of-file flag is set. The length of the partial item read is not
provided, but could be inferred from the result of gztell(). This behavior
is the same as the behavior of fread() implementations in common libraries,
but it prevents the direct use of gzfread() to read a concurrently written
- file, reseting and retrying on end-of-file, when size is not 1.
+ file, resetting and retrying on end-of-file, when size is not 1.
*/
ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len));
@@ -1931,7 +1931,7 @@ ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void));
ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int));
-ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp));
+ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF((z_streamp));
ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
#if defined(_WIN32) && !defined(Z_SOLO)
diff --git a/Utilities/cmzlib/zutil.c b/Utilities/cmzlib/zutil.c
index dcab28a..9543ae8 100644
--- a/Utilities/cmzlib/zutil.c
+++ b/Utilities/cmzlib/zutil.c
@@ -61,9 +61,11 @@ uLong ZEXPORT zlibCompileFlags()
#ifdef ZLIB_DEBUG
flags += 1 << 8;
#endif
+ /*
#if defined(ASMV) || defined(ASMINF)
flags += 1 << 9;
#endif
+ */
#ifdef ZLIB_WINAPI
flags += 1 << 10;
#endif
@@ -119,7 +121,7 @@ uLong ZEXPORT zlibCompileFlags()
# endif
int ZLIB_INTERNAL z_verbose = verbose;
-void ZLIB_INTERNAL z_error (m)
+void ZLIB_INTERNAL z_error(m)
char *m;
{
fprintf(stderr, "%s\n", m);
@@ -214,7 +216,7 @@ local ptr_table table[MAX_PTR];
* a protected system like OS/2. Use Microsoft C instead.
*/
-voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
+voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size)
{
voidpf buf;
ulg bsize = (ulg)items*size;
@@ -240,7 +242,7 @@ voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
return buf;
}
-void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
+void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
{
int n;
@@ -277,13 +279,13 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
# define _hfree hfree
#endif
-voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
+voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size)
{
(void)opaque;
return _halloc((long)items, size);
}
-void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
+void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
{
(void)opaque;
_hfree(ptr);
@@ -302,7 +304,7 @@ extern voidp calloc OF((uInt items, uInt size));
extern void free OF((voidpf ptr));
#endif
-voidpf ZLIB_INTERNAL zcalloc (opaque, items, size)
+voidpf ZLIB_INTERNAL zcalloc(opaque, items, size)
voidpf opaque;
unsigned items;
unsigned size;
@@ -312,7 +314,7 @@ voidpf ZLIB_INTERNAL zcalloc (opaque, items, size)
(voidpf)calloc(items, size);
}
-void ZLIB_INTERNAL zcfree (opaque, ptr)
+void ZLIB_INTERNAL zcfree(opaque, ptr)
voidpf opaque;
voidpf ptr;
{
diff --git a/Utilities/cmzlib/zutil.h b/Utilities/cmzlib/zutil.h
index 824f362..8939d1d 100644
--- a/Utilities/cmzlib/zutil.h
+++ b/Utilities/cmzlib/zutil.h
@@ -199,6 +199,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
(!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
+ ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t));
#endif
/* common defaults */