Commit Graph

31917 Commits

Author SHA1 Message Date
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
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
Brad King
dd1e2cc80c VS: Simplify generation of per-source PCH settings
Avoid looking up the PCH create/use flags just to map them through
flag tables back to the `.vcxproj` settings.  Instead, simply
generate the PCH settings directly for each source file.

Since commit 9df1f33c9a (VisualStudio: move PCH rules to projects when
possible., 2020-10-15, v3.20.0-rc1~638^2) we already do this for the
target-wide PCH settings.
2022-02-03 15:52:22 -05:00
Brad King
736663deed Begin 3.23 release versioning 2022-02-03 09:12:55 -05:00
Brad King
7077916781 Merge topic 'cmake-ignore-prefix-path'
201d8c4298 find_*(): Add CMAKE_IGNORE_PREFIX_PATH variable
bd805a51ae Refactor: Keep track of prefixes in cmSearchPath

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !6880
2022-02-03 07:35:23 -05:00
Brad King
0c0d4e1c7a Merge topic 'cmake-presets-configure-preset-reachability'
c18409cdac CMakePresets.json: Ensure configurePreset is reachable from current file

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6937
2022-02-03 07:32:54 -05:00
Kitware Robot
fb26581653 CMake Nightly Date Stamp 2022-02-03 00:01:15 -05:00
Kyle Edwards
c18409cdac CMakePresets.json: Ensure configurePreset is reachable from current file 2022-02-02 15:17:30 -05:00
Kyle Edwards
201d8c4298 find_*(): Add CMAKE_IGNORE_PREFIX_PATH variable
Fixes: #20878
2022-02-02 11:09:00 -05:00
Kyle Edwards
bd805a51ae Refactor: Keep track of prefixes in cmSearchPath 2022-02-02 11:09:00 -05:00
Brad King
9245925810 Merge topic 'cuda_generic_arch_all'
8f64df0a7c CUDA: Generic all and all-major support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex <leha-bot@yandex.ru>
Merge-request: !6816
2022-02-02 08:23:19 -05:00
Brad King
0f316675cf Merge topic 'dotnet_ref_in_sdk'
5ee3154f65 VS: .Net SDK Style projects can add Reference to dlls

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6932
2022-02-02 08:21:16 -05:00
Kitware Robot
ece32491ab CMake Nightly Date Stamp 2022-02-02 00:01:17 -05:00
Brad King
c138ddb943 Merge topic 'refactor-find-package-cmake-ignore-path'
11f97d1968 find_package(): Refactor CMAKE_[SYSTEM_]IGNORE_PATH
30e5c1d92b find_package(): Add tests for CMAKE_IGNORE_PATH

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !6918
2022-02-01 12:04:33 -05:00
Raul Tambre
8f64df0a7c CUDA: Generic all and all-major support
Commit 14d8a276 (CUDA: Support nvcc 11.5 new -arch=all|all-major flags,
2021-08-17) added all and all-major options to CUDA_ARCHITECTURES. These are
fairly generic and likely to see real-world use by distributors. Thus it's
desirable to support these also for Clang and older NVCC versions.

The supported architectures are dependent on the toolkit version. We determine
the toolkit version prior to compiler detection. For NVCC we get the version
from the vendor identification output, but for Clang we need to invoke NVCC
separately.

The architecture information is mostly based on the Wikipedia list with the
earliest supported version being CUDA 7.0. This could be documented and
expanded in the future to allow projects to query CUDA toolkit version and
architecture information.
For Clang we additionally constrain based on its support.

Additionally the architecture mismatch detection logic is fixed, improved and
updated for generic support:
* Commit 01428c55 (CUDA: Fail fast if CMAKE_CUDA_ARCHITECTURES doesn't work
  during detection, 2020-08-29) enabled CMAKE_CUDA_COMPILER_ID_REQUIRE_SUCCESS
  if CMAKE_CUDA_ARCHITECTURES is specified. This results in
  CMakeDetermineCompilerID.cmake printing the compiler error and our code for
  presenting the mismatch in a user-friendly way being useless. The custom
  logic seems preferable so go back to not enabling it.
* Commit 14d8a276 (CUDA: Support nvcc 11.5 new -arch=all|all-major flags,
  2021-08-17) tried to support CMP0054 but forgot to add x to the interpolated
  result. Thus the conditions would always evaluate to false. This is fixed as
  a byproduct of removing NVIDIA specific checks, improving the error message
  and replacing architectures_mode with a simpler architectures_explicit.

Visual Studio support omits testing the flags during detection due to
complexities in determining the toolkit version when using it.
A long-term proper implementation would be #23161.

Implements #22860.
2022-02-01 18:25:20 +02:00
Brad King
012ea11ea4 Merge topic 'update-kwsys'
1e242a95d0 Merge branch 'upstream-KWSys' into update-kwsys
7d9204a7e2 KWSys 2022-01-31 (9fd1660a)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6930
2022-02-01 10:38:07 -05:00
Sumit Bhardwaj
5ee3154f65 VS: .Net SDK Style projects can add Reference to dlls
When support for `DOTNET_SDK` was added, only a minimal set of options
were built in. Based on user feedback, support for reference to dlls
(not just projects) is needed. That support is added here.

Fixes: #23166
2022-02-01 07:18:03 -08:00
Kitware Robot
0294570d06 CMake Nightly Date Stamp 2022-02-01 00:01:17 -05:00
Brad King
1e242a95d0 Merge branch 'upstream-KWSys' into update-kwsys
# By KWSys Upstream
* upstream-KWSys:
  KWSys 2022-01-31 (9fd1660a)
2022-01-31 15:27:01 -05:00
Kyle Edwards
11f97d1968 find_package(): Refactor CMAKE_[SYSTEM_]IGNORE_PATH
In the old implementation, CMAKE_[SYSTEM_]IGNORE_PATH was handled
in cmFindCommon. Move it into cmFindPackageCommand.
2022-01-31 10:41:04 -05:00
Brad King
5305d5aa1a Merge topic 'link-interface-direct'
f3ad061858 Add usage requirements to update direct link dependencies
193a999cd5 cmTarget: Add INTERFACE_LINK_LIBRARIES_DIRECT{,_EXCLUDE} backtrace storage
22d5427aa6 cmGeneratorTarget: Add LookupLinkItem option to consider own target name
f3d2eab36a cmGeneratorTarget: Fix link interface caching of partial results
d75ab9d066 cmGeneratorTarget: Clarify CMP0022 logic in ComputeLinkInterfaceLibraries
f3e9e03fe0 cmGeneratorTarget: Simplify CMP0022 warning check
216aa14997 cmGeneratorTarget: Return early from ExpandLinkItems with no items
1bc98371d1 Tests: Remove unnecessary policy setting from ObjectLibrary test
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6886
2022-01-31 10:36:55 -05:00
Brad King
d3006c0ca7 Merge topic 'shorter-obj'
5f8c5657a9 Shorten object name even if still longer than CMAKE_OBJECT_PATH_MAX

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6915
2022-01-31 10:30:30 -05:00
Brad King
3de6155ca0 Merge topic 'update-kwsys'
e83bb75160 Merge branch 'upstream-KWSys' into update-kwsys
d01d634bc7 KWSys 2022-01-29 (389a74dc)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6919
2022-01-31 10:29:38 -05:00
Kitware Robot
cacfadd84a CMake Nightly Date Stamp 2022-01-31 00:01:31 -05:00
Kitware Robot
4b033ca0eb CMake Nightly Date Stamp 2022-01-30 00:01:13 -05:00
Brad King
e83bb75160 Merge branch 'upstream-KWSys' into update-kwsys
# By KWSys Upstream
* upstream-KWSys:
  KWSys 2022-01-29 (389a74dc)
2022-01-29 07:06:10 -05:00
Brad King
f3ad061858 Add usage requirements to update direct link dependencies
Link line construction starts with `LINK_LIBRARIES` and appends
dependencies from the transitive closure of `INTERFACE_LINK_LIBRARIES`.
Only the entries of `LINK_LIBRARIES` are considered direct link
dependencies.  In some advanced use cases, particularly involving static
libraries and static plugins, usage requirements need to update the list
of direct link dependencies.  This may mean adding new items, removing
existing items, or both.

Add target properties to encode these usage requirements:

* INTERFACE_LINK_LIBRARIES_DIRECT
* INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE

Fixes: #22496
2022-01-29 06:48:13 -05:00
Brad King
193a999cd5 cmTarget: Add INTERFACE_LINK_LIBRARIES_DIRECT{,_EXCLUDE} backtrace storage
These properties will be given meaning by later commits.
2022-01-29 06:48:12 -05:00
Brad King
22d5427aa6 cmGeneratorTarget: Add LookupLinkItem option to consider own target name 2022-01-29 06:48:12 -05:00
Brad King
f3d2eab36a cmGeneratorTarget: Fix link interface caching of partial results
`GetLinkInterface` and `GetLinkInterfaceLibraries` cache their results
to avoid repeating work.  In the case that the result does not depend on
the "head" target, they re-use results computed from the first call with
any "head" target.  However, if `GetLinkInterfaceLibraries` is called
first, then not all of the link interface is populated.  If
`GetLinkInterface` is later called, it needs to finish populating the
link interface even if a partially completed interface was cached.
2022-01-29 06:48:12 -05:00
Brad King
d75ab9d066 cmGeneratorTarget: Clarify CMP0022 logic in ComputeLinkInterfaceLibraries
Follow up commit 1d709ea2f5 (cmGeneratorTarget: Propagate backtraces
from INTERFACE_LINK_LIBRARIES, 2021-12-15), which made the logic a bit
more complicated due to having backtraces for CMP0022 NEW behavior.
2022-01-29 06:48:12 -05:00
Brad King
f3e9e03fe0 cmGeneratorTarget: Simplify CMP0022 warning check
Since commit 1d709ea2f5 (cmGeneratorTarget: Propagate backtraces from
INTERFACE_LINK_LIBRARIES, 2021-12-15) we can use the special storage of
the property directly.
2022-01-29 06:48:12 -05:00
Brad King
216aa14997 cmGeneratorTarget: Return early from ExpandLinkItems with no items 2022-01-29 06:48:12 -05:00
Brad King
4e8f24e977 PCH: Clear link interface cache when adding PCH object to it
On platforms using `CMAKE_LINK_PCH`, the implementation of
`PRECOMPILE_HEADERS_REUSE_FROM`, when re-using the PCH from one object
library in another, adds a PCH object file to the link interface.
Clear any cached link interface to ensure it is used.
2022-01-29 06:48:11 -05:00
Brad King
854e67985e cmLinkItem: Clarify name of CMP0027 check member
The only purpose of `cmLinkImplItem`'s `FromGenex` member is to decide
whether to check CMP0027.  That won't be needed for link items added by
new interfaces in the future.  Clarify the name to indicate that we do
not always need to know if the item came from a generator expression.
2022-01-29 06:48:11 -05:00