32538 Commits

Author SHA1 Message Date
Brad King
451d1c8b6c CMake 3.24.4 2023-03-08 09:15:32 -05:00
Brad King
a5d6548587 file(INSTALL): Fix file ownership regression when running as root on macOS
Backport KWSys commit `51272e80e` (SystemTools: Avoid macOS copyfile
semantic differences as root, 2023-03-07).

Fixes: #24577
2023-03-07 11:36:25 -05:00
Brad King
3e0ccd6469 Merge branch 'compile-msvc-14.34-c++20' into release-3.24
Merge-request: !7910
2022-11-14 12:16:46 -05:00
Werner, Joerg
a394c9416d cmGlobalVisualStudioGenerator: Fix compiling as C++20 in VS 2022
Adding missing narrow string conversion.

This backports commit f3c918ef1b (cmGlobalVisualStudioGenerator: Fix
compiling as C++20 in VS 2022, 2022-10-20, v3.25.0-rc3~31^2) to the
CMake 3.23 and 3.24 branches.

Fixes: #24162
2022-11-14 12:07:16 -05:00
Sean McBride
9684a589ca Source: Replace uses of sprintf with safer snprintf in CMake 3.24 branch
Backport commit d5694e4623 (Source: Replace uses of sprintf with safer
snprintf, 2022-06-17, v3.25.0-rc1~587^2) to the CMake 3.24 branch. This
is needed to compile without warnings using Xcode 14.1's macOS 13.0 SDK.
2022-11-03 11:58:31 -04:00
Brad King
eea23d21a3 Source: Tell Git not to check whitespace in third-party curses form code 2022-11-03 11:58:30 -04:00
Brad King
c974557598 CMake 3.24.3 2022-11-01 10:55:49 -04:00
Brad King
91ccfa3302 CMake 3.23.5 2022-11-01 09:36:33 -04:00
Brad King
ae917dc682 Merge branch 'cpack-trace-argument' into release-3.24
Merge-request: !7824
2022-10-27 09:25:24 -04:00
Brad King
77e4042204 Merge branch 'vswhere-support-x86' into release-3.24
Merge-request: !7832
2022-10-27 09:25:08 -04:00
Brad King
e677cc421d Merge branch 'ninja-intl-paths' into release-3.24
Merge-request: !7833
2022-10-27 09:24:46 -04:00
Brad King
02a04dd9c7 Ninja: Restore support for non-ascii paths on Windows with ninja<=1.10
Revert commit bbdb000c55 (GlobalNinjaGenerator: enlarge file stream
buffer, 2022-01-25, v3.23.0-rc1~68^2).  Somehow `rdbuf()->pubsetbuf()`
is resetting our imbued locale and `cm_codecvt` that handles encoding.

Fixes: #24089
2022-10-26 15:24:43 -04:00
Brad King
6eee8c9000 VS: Fix crash finding vswhere on 32-bit Windows
Since commit f85913fa08 (VS: Add support for enumerating VS instances
with vswhere, 2022-04-11, v3.24.0-rc1~282^2), if the COM lookup does not
report any VS instances, we fall back to finding vswhere.  However, the
`getenv` call returns nullptr if the `ProgramFiles(x86)` environment
variable is not set.  Update the logic to tolerate not-set environment
variables.  Also check the plain `ProgramFiles` environment variable.

Fixes: #24090
2022-10-26 11:12:46 -04:00
Kyle Edwards
b5ebaa0d9c CPack: Require no argument for --trace and --trace-expand
This was accidentally broken by commit 87c762d435 (CPack: Use
cmCommandLineArgument instead of cmsys::CommandLineArguments,
2022-04-18, v3.24.0-rc1~258^2).

Fixes: #24085
2022-10-25 10:11:20 -04:00
Brad King
47063db58d Merge branch 'filesystem-path-c++03-abi' into release-3.24
Merge-request: !7813
2022-10-20 19:03:52 -04:00
Brad King
ee9805ccd1 cm/filesystem: Fix crash with pre-C++11 std::string GNU ABI in C++17
The `remove_filename` and `replace_extension` methods compute an offset
between the whole path in a `std::string` and a part of a path in a
`std::string_view`.  This is done by subtracting their `.data()`
pointers.  However, C++17 adds a non-const `.data()` through which
modification of the string is allowed.  This means the copy-on-write
implementation used by the pre-C++11 std::string GNU ABI must reallocate
if the string has been copied.  Our subtraction then computes an offset
between two different allocations, which is undefined behavior.

The workaround in commit b3ca4f9ad1 (cm/filesystem: Work around crash
when compiled for CYGWIN/MSYS runtime, 2021-04-22, v3.21.0-rc1~271^2~2)
avoided the problem by calling the non-const `.data()` to reallocate
before constructing the `string_view`.  Instead, explicitly call the
const `.data()` method on the string, which does not reallocate.

Fixes: #22090, #23328
2022-10-20 18:31:50 -04:00
Brad King
588c9c4145 Merge branch 'try_compile-CMP0128' into release-3.24
Merge-request: !7803
2022-10-18 14:25:52 -04:00
Brad King
50e90e2828 try_compile: Honor CMP0128 setting in test project
Some projects pass a raw `-std=` flag to the compiler in the
`try_compile` project.  If they do not set CMP0128 to NEW,
we should not append a `-std=` flag where we did not before
the policy was added.

Fixes: #24063
2022-10-18 13:38:00 -04:00
Brad King
ab8a0a106e COMPILE_WARNING_AS_ERROR: Fix internal formatting of options table
In commit 76a08cd253 (COMPILE_WARNING_AS_ERROR: Add options to treat
warnings as errors, 2022-04-21, v3.24.0-rc1~173^2) we formatted the
options table entries as command-line string fragments.  Since they are
part of the `CMAKE_${lang}_COMPILE_OPTIONS_*` tables, they should be
formatted as `;`-separated lists of compiler options.
2022-10-07 10:05:21 -04:00
Brad King
34a6da34b8 CMake 3.23.4 2022-10-04 13:26:33 -04:00
Brad King
12c6fec6b4 Xcode: Drop CMAKE_INTDIR= definition in Swift targets
Xcode 14.0 warns that Swift doesn't support definition values.
Therefore `CMAKE_INTDIR` is not useful to Swift sources.  Drop it.
2022-09-30 13:08:05 -04:00
Zack Galbreath
65260d6c1e ctest: only report make-level errors when no others are found
In commit ab9ad2a6a0 (ctest: report make-level errors to CDash when
using launchers, 2020-09-24, v3.19.0-rc1~84^2~1) we taught CTest to
capture and report errors from the build command when using launchers.

This had the unintended side effect of reporting a separate build error containing
the full build output when the build command returns non-zero. To fix this problem,
we now only report build command errors from CTest launchers when no other
more specific build errors are found.

Fixes: #23991
2022-09-26 09:40:58 -04:00
Brad King
3e20442246 Merge topic 'parse-large-int' into release-3.24
8fc822e13a file: Avoid strange istringstream crash in cmake.org binaries on Alpine Linux
31f158e4c8 cmStringAlgorithms: Add functions to parse strings to long long integers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7698
2022-09-21 10:12:10 -04:00
Brad King
8fc822e13a file: Avoid strange istringstream crash in cmake.org binaries on Alpine Linux
Somehow using `istringstream` and `operator >>` to parse an integer
crashes on Alpine Linux, at least when compiled with the settings we use
for the official `cmake.org` Linux binaries.  Since commit fd0c285b12
(file: Fix types of the OFFSET and LIMIT arguments, 2022-01-04,
v3.23.0-rc1~133^2), this causes the `file(READ)` command to crash when
parsing its `LIMIT` or `OFFSET` argument.  Parse the input string with
our dedicated helper to avoid the crash.

Fixes: #23872
2022-09-20 12:00:08 -04:00
Brad King
31f158e4c8 cmStringAlgorithms: Add functions to parse strings to long long integers 2022-09-20 12:00:08 -04:00
Marc Chevrier
fc06450ff4 Apple: Fix regression when linking a framework with postfix
Fix a regression caused by commit 40178f3c90 (cmGlobalGenerator: Add
helper to split framework path, 2022-02-10, v3.24.0-rc1~661^2~1).

Fixes: #23961
2022-09-14 14:55:27 -04:00
Brad King
31f835410e CMake 3.24.2 2022-09-13 09:53:22 -04:00
Brad King
6695957237 Merge topic 'truncation_invalid' into release-3.24
bd30d20bc3 Tests: Add cases covering bad ctest output truncation types
dbf840392d ctest: print error for invalid CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7596
2022-09-09 09:52:04 -04:00
Brad King
11754888a8 Merge topic 'revert-automoc-silence-warnings' into release-3.24
e08d34eda1 automoc: revert attempts to silence linker warning on macos

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7652
2022-09-09 09:50:04 -04:00
Frank Winklmeier
dbf840392d ctest: print error for invalid CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION
Print an error message for invalid values of
`CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION` in a ctest dashboard script.
The option was added by commit 140704d443 (ctest: add option for
output truncation, 2022-03-07, v3.24.0-rc1~513^2).

Fixes: #23869
2022-09-07 11:52:03 -04:00
Brad King
e08d34eda1 automoc: revert attempts to silence linker warning on macos
We've made several attempts to add a dummy symbol to `mocs_compilation.cpp`
when there are no automoc sources:

* commit 4a9daae483 (automoc: silence linker warning on macos,
                     2022-05-25, v3.24.0-rc1~55^2)
* commit 844244ccdc (automoc: avoid compiler warnings in linker-warning-
                     silencing code, 2022-08-10, v3.24.1~6^2)
* commit fc8628389f (automoc: avoid more compiler warnings in linker-
                     warning-silencing code, 2022-08-29)

The last attempt derives a symbol name from the path to the source
file, but that breaks reproducible builds because it is not stable
w.r.t. the location of the build tree.  Revert all these attempts
for the 3.24 release series, and return to what 3.23 and below did.
Further investigation will be needed to resolve the original issue.

Fixes: #23937
Issue: #23551, #23823, #23823
2022-09-07 10:35:17 -04:00
Marc Chevrier
985b4c82a6 Check link libraries properties: fix performances regression
Fixes: #23939
2022-09-07 15:20:53 +02:00
Marc Chevrier
a47eef32a3 renames method FinalizeTargetCompileInfo() in FinalizeTargetConfiguration(). 2022-09-07 14:23:21 +02:00
Brad King
85d29b7de1 Merge topic 'Link-MACOSX_BUNDLE' into release-3.24
f5a441a616 Xcode: Fix erroneous MACOSX_BUNDLE link

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7624
2022-09-01 09:58:16 -04:00
Marc Chevrier
f5a441a616 Xcode: Fix erroneous MACOSX_BUNDLE link
Refactoring in commit a2cfa2da4f (GenEx/LINK_LIBRARY: Add features for
framework support on Apple, 2022-02-10, v3.24.0-rc1~661^2) accidentally
removed a `GetParentDirectory` call.  Restore it.

Fixes: #23891
2022-08-31 09:52:38 -04:00
Brad King
3aebeb1b55 Merge topic 'CMAKE_FIND_USE_INSTALL_PREFIX-support-staging-prefix' into release-3.24
0fc10bb19b CMAKE_FIND_USE_INSTALL_PREFIX considers CMAKE_STAGING_PREFIX
43d31c5198 cmFindBase: Refactor CMAKE_FIND_USE_INSTALL_PREFIX handling

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7623
2022-08-31 09:39:51 -04:00
Robert Maynard
0fc10bb19b CMAKE_FIND_USE_INSTALL_PREFIX considers CMAKE_STAGING_PREFIX
Fixes #23900
2022-08-30 17:52:40 -04:00
Robert Maynard
43d31c5198 cmFindBase: Refactor CMAKE_FIND_USE_INSTALL_PREFIX handling 2022-08-30 15:26:30 -04:00
Albert Astals Cid
fc8628389f automoc: avoid more compiler warnings in linker-warning-silencing code
Revise the approach from commit 844244ccdc (automoc: avoid compiler
warnings in linker-warning-silencing code, 2022-08-10, v3.24.1~6^2)
to avoid `-Wmissing-declarations` warnings too.

Issue: #23823
2022-08-30 15:21:12 -04:00
Kyle Edwards
970052fedd FILE_SET: Fix source group detection
Call MatchChildrenFiles() instead of MatchesFiles() in order to
account for files being in subgroups of source groups.

Fixes: #23880
2022-08-24 16:07:24 -04:00
Brad King
c3793b4157 CMake 3.24.1 2022-08-17 12:54:57 -04:00
Brad King
349071d6ab Merge topic 'export-no-shdeps' into release-3.24
0ebff0d61a export: Restore exclusion of private shared library dependencies from checks

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7557
2022-08-16 12:42:20 -04:00
Brad King
0ebff0d61a export: Restore exclusion of private shared library dependencies from checks
Refactoring in commit 8c65b7042e (cmExportFileGenerator: Simplify
collection of targets missing from export set, 2022-04-11,
v3.24.0-rc1~281^2) accidentally dropped the behavior change from
commit 0ad2a1c181 (Export: Never treat private link libraries as
public package dependencies., 2013-09-24, v3.0.0-rc1~559^2).
Restore the behavior and add a test.

Fixes: #23838
2022-08-15 10:40:03 -04:00
Albert Astals Cid
844244ccdc automoc: avoid compiler warnings in linker-warning-silencing code
Revise the code added by !7296 (merged).
Make cmake_automoc_silence_linker_warning less warning-y.
Fix weak-tables clang warning and copyable-polymorph clazy warning.

Fixes: #23823
2022-08-10 22:03:11 +02:00
Brad King
4be24f031a CMake 3.24.0 2022-08-04 09:53:57 -04:00
Brad King
5e0b06fe84 Makefiles: Restore path consistency in the global dispatch makefile
Directory-level rules in `CMakeFiles/Makefile2` were previously
previously written by each directory's local generator using its own
decision for using relative or absolute paths.

Since commit d33b12d84b (Add support for build tree symlink inside
source tree, 2022-02-25, v3.24.0-rc1~583^2), each local generator
explicitly models the relationship between its source and build paths,
and uses this to determine when it is safe to use relative paths.
Because `add_subdirectory` supports arbitrary placement of the source
and build directories, different local generators may have different
relationships between their source and build paths.  This can cause
disagreement among rules written to `CMakeFiles/Makefile2`.

Restore consistency by always using the root local generator to write
rules to `CMakeFiles/Makefile2`.  Relative paths should always be
expressed w.r.t. the top-level build directory since that is the working
directory in which the `make` tool processing the file will run.

Fixes: #23814
2022-08-03 14:58:47 -04:00
Kyle Edwards
83e44002ae VERIFY_INTERFACE_HEADER_SETS: Add verification target for all
Fixes: #23802
2022-08-03 08:19:08 -04:00
Brad King
e18fb0c73e Merge topic 'vs-msbuild-arm64' into release-3.24
c165dd6a83 VS: Fix ARM64 host architecture detection in x86 binary

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7525
2022-08-02 09:30:03 -04:00
Brad King
a4f1c0fac8 Windows: Revert "Prefer junctions for directory symlinks"
Revert commit 5101d586c4 (Windows: Prefer junctions for directory
symlinks, 2022-02-22, v3.24.0-rc1~575^2).  Junctions do not support
`../` and other non-canonical paths.  Revert their use pending further
investigation.

Fixes: #23781
Issue: #23257
2022-08-01 10:59:20 -04:00
Anton Lapounov
c165dd6a83 VS: Fix ARM64 host architecture detection in x86 binary
Use the 64-bit registry view when we check whether Windows
has the ARM64 version of the .NET Framework 4.x installed.

Issue: #23755
2022-08-01 10:16:14 -04:00