Commit Graph

31950 Commits

Author SHA1 Message Date
Brad King
66ba460810 CMake 3.23.0-rc4 2022-03-18 08:26:30 -04:00
Brad King
b782d9e124 Merge topic 'always_prefer_last_source_dir' into release-3.23
b44ad7992a cmake: Always prefer the last source directory provided

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7084
2022-03-18 07:16:23 -04:00
Robert Maynard
b44ad7992a cmake: Always prefer the last source directory provided
Fixes: #23334
2022-03-17 15:23:01 -04:00
Brad King
add64399c5 target_link_libraries: Restore LINK_ONLY for multiple static lib dependencies
Since commit c1e812ad4f (target_link_libraries: Improve tolerance of
unquoted generator expressions, 2022-02-15, v3.23.0-rc2~11^2) we
accumulate consecutive non-keyword arguments to recover an unquoted
generator expression as a single entry.  When given multiple consecutive
non-genex library names, the grouping breaks our logic that expects each
entry is either a raw target name or a genex.  Revise the logic to only
accumulate multiple arguments when they end inside a partial genex.

This bug caused `target_link_libraries` to stop wrapping static library
private dependencies in `$<LINK_ONLY:...>` for `INTERFACE_LINK_LIBRARIES`
when multiple consecutive library names are given.  Add a test case
covering that behavior.

Fixes: #23302
2022-03-16 10:47:32 -04:00
Brad King
736e80dbca CMake 3.23.0-rc3 2022-03-10 09:11:13 -05:00
Kyle Edwards
f54507c2f6 CMakePresets.json: Add ${fileDir} macro
Fixes: #23214
2022-03-07 18:03:16 -05:00
Brad King
65da32c924 Merge topic 'file-set-name-requirements' into release-3.23
b357d334fc target_sources(): Enforce stricter requirements for FILE_SET name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7037
2022-03-04 09:09:31 -05:00
Brad King
31743aaf5d Merge topic 'file-set-multiple-names' into release-3.23
8c23ecbd93 target_sources(): Process multiple FILE_SET arguments per block

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7040
2022-03-04 09:07:03 -05:00
Brad King
d7febfc727 Merge topic 'while-bug-compatibility' into release-3.23
da2361ffb3 while: Restore tolerance of condition error
47d197745a Tests: Simplify RunCMake.{if,while} unbalanced parenthesis cases

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7041
2022-03-04 08:53:16 -05:00
Alex Turbov
da2361ffb3 while: Restore tolerance of condition error
Since commit 880ca66b51 (Fix: `while()` can silently ignore incorrect
condition, 2021-08-09, v3.22.0-rc1~238^2~4) we correctly reject the
code

    set(paren "(")
    while(${paren})
    endwhile()

However, rejecting it breaks compatibility with projects that used such
code accidentally.  In CMake 3.21 and below, any error in the condition
was ignored because the `false` result exited the loop first.  Restore
tolerance of the error for now.  A policy will be needed to make it an
error later.

Note that the same condition with `if` was always correctly rejected.

Fixes: #22524
Issue: #23296
Co-authored-by: Brad King <brad.king@kitware.com>
2022-03-03 16:51:34 -05:00
Kyle Edwards
8c23ecbd93 target_sources(): Process multiple FILE_SET arguments per block
Fixes: #23287
2022-03-03 14:31:54 -05:00
Brad King
77804f6358 Merge topic 'cmake-dir-args' into release-3.23
d2e9478321 Tests: Add RunCMake.CommandLine ExplicitiDirs explicit work directory
78e8f11456 cmake: Correct regression in `-B <dir> <src_dir>`
4091d5c58c Tests: Verify RunCMake.CommandLine ExplicitDirs source/build dirs
1b97f8f35c Tests: Clarify RunCMake.CommandLine ExplicitDirs case names

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7030
2022-03-03 11:46:28 -05:00
Brad King
9c48040ffb Merge topic 'update-kwsys' into release-3.23
a20ad92022 KWSys: SystemInformation: Add Zhaoxin x86 processor kh40000

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7032
2022-03-03 11:42:28 -05:00
Kyle Edwards
b357d334fc target_sources(): Enforce stricter requirements for FILE_SET name
Fixes: #23286
2022-03-03 10:17:10 -05:00
Robert Maynard
78e8f11456 cmake: Correct regression in -B <dir> <src_dir>
Fixes: #23285
2022-03-02 12:21:16 -05:00
Brad King
04a7200c75 Merge topic 'cuda-arch-all' into release-3.23
2796d6eeca CUDA: Fix CMAKE_CUDA_ARCHITECTURES=all/all-major with NVCC 11.5+
e450d55552 Help: Update CUDA_ARCHITECTURES docs for generic all/all-major support
fe64c49e72 CUDA: Simplify CMAKE_CUDA_ARCHITECTURES special value logic

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7026
2022-03-02 07:52:17 -05:00
Brad King
4b9227e718 Merge topic 'find_file_frameworks_debug_output' into release-3.23
3354d52e3d find_file: Fix blank line instead of framework path in debug output

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7024
2022-03-02 07:46:57 -05:00
Joker-Van
a20ad92022 KWSys: SystemInformation: Add Zhaoxin x86 processor kh40000
Backport KWSys commit `dfec20c95` (SystemInformation: Add Zhaoxin x86
processor kh40000, 2022-03-02) to the CMake 3.23 release branch.
2022-03-02 07:27:44 -05:00
Brad King
fe64c49e72 CUDA: Simplify CMAKE_CUDA_ARCHITECTURES special value logic
Refactor the logic checking `CMAKE_CUDA_ARCHITECTURES` special values.
Switch on the value first, and then make other decisions for each case.
This makes room for other special values to be added later.
2022-02-28 21:30:23 -05:00
Craig Scott
3354d52e3d find_file: Fix blank line instead of framework path in debug output
There's no point printing a blank line if FindHeaderInFramework()
returns an empty string. Pass in the debug object to that function
instead so it can record the actual paths it tests in the debug output
directly.
2022-03-01 09:28:22 +11:00
Kyle Edwards
ad41c9cd11 target_sources(): Prohibit FILE_SET on custom targets
Fixes: #23262
2022-02-28 17:21:04 -05:00
Peter Hill
6b4885b58b Ninja: Avoid preprocessing twice with explicit Fortran_PREPROCESS
Fix spurious warnings from gfortran+Ninja for preprocessing.

Fixes: #23248
2022-02-24 12:54:46 -05:00
Brad King
352ea99bba CMake 3.23.0-rc2 2022-02-23 09:22:31 -05:00
Brad King
f75299b803 CUDA: Restore support for non-"all" CUDA_ARCHITECTURES with nvcc 11.5+
Since commit 8f64df0a7c (CUDA: Generic all and all-major support,
2021-12-19, v3.23.0-rc1~23^2), setting `CUDA_ARCHITECTURES` to a value
other than `all` or `all-major` is ignored with NVCC 11.5+.  Fix the
logic to return early only when actually using an "all" value.

Fixes: #23243
2022-02-18 12:54:12 -05:00
Brad King
a1cb448580 Merge topic 'correct_multiple_source_warnings' into release-3.23
7083b19498 cmake: When given multiple source paths use last instead of first

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7001
2022-02-18 09:01:21 -05:00
Robert Maynard
7083b19498 cmake: When given multiple source paths use last instead of first
When given two source paths via `-S` or just directory paths prefer
the last one. When the paths are mixed always prefer the last `-S`
entry.

Fixes: #23238
2022-02-17 16:54:30 -05:00
Kyle Edwards
058b8a0bfb install(): Properly ignore FILE_SETs that don't exist
Fixes: #22960
2022-02-17 14:43:06 -05:00
Brad King
9c81f2cb8b Merge topic 'cmake-empty-cmd-line-arg' into release-3.23
f73457ca2e cmake: Ignore any empty "" command line arguments
67f97f5478 Tests: Add RunCMake helper to run cmake with raw execute_process args

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6980
2022-02-17 08:45:52 -05:00
Robert Maynard
f73457ca2e cmake: Ignore any empty "" command line arguments
Don't treat empty quote arguments("") as the current working
directory but instead ignore them.

Fixes #23217
2022-02-16 12:11:33 -05:00
Brad King
368dc57979 Merge topic 'tll-genex-concat' into release-3.23
c1e812ad4f target_link_libraries: Improve tolerance of unquoted generator expressions
5571a31648 target_link_libraries: Handle keyword arguments in dedicated code path
42590df9f9 target_link_libraries: Remove likely-broken ancient compatibility check

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6989
2022-02-16 09:47:45 -05:00
Brad King
c1e812ad4f target_link_libraries: Improve tolerance of unquoted generator expressions
Prior to commit 1d709ea2f5 (cmGeneratorTarget: Propagate backtraces from
INTERFACE_LINK_LIBRARIES, 2021-12-15, v3.23.0-rc1~228^2), the value of
`INTERFACE_LINK_LIBRARIES` was a single string.  If an unquoted
generator expression passed to `target_link_libraries` contained `;` and
became multiple arguments, they would all accumulate as a single
`;`-separated list in the value of `INTERFACE_LINK_LIBRARIES`.  Since
that commit, each argument to `target_link_libraries` is placed in
`INTERFACE_LINK_LIBRARIES` as a separate entry, as has long been the
case for `LINK_LIBRARIES`. That behavior change broke projects that were
accidentally relying on accumulation in `INTERFACE_LINK_LIBRARIES` to
produce complete generator expressions containing `;`.

Teach `target_link_libraries` to accumulate consecutive non-keyword
arguments into a single entry before placing them in `LINK_LIBRARIES` or
`INTERFACE_LINK_LIBRARIES`.  For example, treat `a b c` as if they were
written as `"a;b;c"`.  This restores the previously accidental support
for unquoted generator expressions in `INTERFACE_LINK_LIBRARIES`, and
also enables it for `LINK_LIBRARIES`.

For now, do not drop the `target_link_libraries` documentation that
recommends quoting generator expressions.  Quoting is still important to
populate `LINK_LIBRARIES` in CMake 3.22 and below, and is also good
practice to keep generator expressions whole.

Fixes: #23203
2022-02-15 17:38:33 -05:00
Brad King
5571a31648 target_link_libraries: Handle keyword arguments in dedicated code path 2022-02-15 17:17:49 -05:00
Brad King
42590df9f9 target_link_libraries: Remove likely-broken ancient compatibility check
Since commit daa6d2bc04 (ENH: updated handling of debug and optimized
target link libraries, 2006-11-29, v2.6.0~2471) the ancient
`<lib>_LINK_TYPE` compatibility lookup was done using the name of the
dependent target for which `target_link_libraries` is called, rather
than the name of the library dependency being considered.  This code
probably does nothing.  Remove it.
2022-02-15 17:17:49 -05:00
Carsten Rudolph
f320a31087 cmake --build: prioritize --resolve-package-references over preset
Fixes: #23224
2022-02-15 10:20:02 -05:00
Craig Scott
8efd4b5378 cmake::GetDebugFindPkgOutput: Use consistent argument name
The argument name used in the class declaration didn't match the one
used in the implementation file. The one in the header appears to be a
cut-n-paste from GetDebugFindOutput(), but the implementation makes
it clear that "pkg" better infers what the argument represents than "var".
2022-02-14 21:12:44 +11:00
Brad King
38de1bef2d find_package: Improve --debug-find-pkg= when using a find module
Extend the feature added by commit d7b18895bc (cmake: Add filtered
debug-find options, 2021-12-07, v3.23.0-rc1~217^2) to enable debug
output for `find_*` calls within a find module or cmake package
configuration file.

Fixes: #23211
2022-02-10 16:30:10 -05:00
Brad King
d634d20397 find_package: Avoid printing debug output header multiple times 2022-02-10 16:30:10 -05:00
Brad King
df3e29450a find_package: Mention package name in Config mode debug output
Otherwise, if there are no paths considered then the output does not
specify the name of the package.
2022-02-10 16:30:09 -05:00
Brad King
636ca7f25c find_package: Fix find module name in --debug-find output 2022-02-10 16:30:09 -05:00
Brad King
596e185409 find_package: Improve formatting of --debug-find output
Also spell out more complete content in the test's expect output.
2022-02-10 16:30:04 -05:00
Brad King
a690523fcf cmFindPackageCommand: Drop ComputeIfDebugModeWanted overload
The overload for `--debug-find-pkg` has the same signature as the base
class method for `--debug-find-var`.  To avoid confusion, drop the
overload and inline it its only call site.
2022-02-10 15:25:05 -05:00
Brad King
5a65e08644 Merge topic 'restore-target-export-includes' into release-3.23
83d79636bf install(TARGETS): Restore per-export INCLUDES DESTINATION

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !6969
2022-02-10 09:07:34 -05:00
Eugene Shalygin
83d79636bf install(TARGETS): Restore per-export INCLUDES DESTINATION
In commit 55e4753bbb (Refactor cmTargetExport removing
InterfaceIncludeDirecories, 2021-07-20, v3.22.0-rc1~337^2~1) the storage
of `INCLUDES DESTINATION` was moved into each target.  However, a target
may be installed in multiple exports, and their `INCLUDES DESTINATION`
should not be mixed.

Convert the IncludeDirectoriesEntries vector to a map and modify access
function to store the directories lists with respect to cmExportTarget
object. This fixes error when the same target is exported more than once
via different exports and each for consequent export its include
directories list grows. Add a test for this case.

Fixes: #23183
2022-02-09 13:31:26 -05:00
Brad King
a15cc7706d CMake 3.23.0-rc1 2022-02-08 10:43:14 -05:00
Brad King
6e32db4fb3 Merge topic 'dotnet_sdk' into release-3.23
5cdd774d51 VS: Handle build target correct for .NET SDK style projects with Any CPU
309191052c VS: Set Visual Studio versions read out from solution file
f7791698cb VS: Allow setting output directory in .NET SDK style projects

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6944
2022-02-08 08:39:34 -05:00
Florian Schweiger
5cdd774d51 VS: Handle build target correct for .NET SDK style projects with Any CPU
* Extend Visual Studio solution parser for reading build target
* Map solution build target to project build target (especially for Any CPU)
* Use C++ <optional> template instead of pointer return value for cmSlnData::GetProjectByGUID
2022-02-07 13:08:37 +01:00
Florian Schweiger
309191052c VS: Set Visual Studio versions read out from solution file 2022-02-07 13:07:40 +01:00
Florian Schweiger
f7791698cb VS: Allow setting output directory in .NET SDK style projects 2022-02-07 12:03:03 +01:00
Brad King
ce00bfd75e Merge topic 'vs-simplify-pch' into release-3.23
dd1e2cc80c VS: Simplify generation of per-source PCH settings

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6950
2022-02-04 08:19:18 -05:00
Brad King
d184bf0659 Replace DEVEL_CMAKE_VERSION with literal 3.23 release version
This was accidentally left out of commit 736663deed (Begin 3.23 release
versioning, 2022-02-03).  The step is documented as part of the release
branching process in the CMake Maintainer Guide `Help/dev/maint.rst`.
2022-02-04 06:44:22 -05:00