Commit Graph

9006 Commits

Author SHA1 Message Date
Brad King
b996e576c2 Merge topic 'GoogleTest-dots'
1f9554d4e9 GoogleTest: Fix regex matching all dots in the suite name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6822
2022-01-07 10:23:54 -05:00
Francesco Guastella
1f9554d4e9 GoogleTest: Fix regex matching all dots in the suite name 2022-01-07 09:25:57 -05:00
Brad King
ac892a64a9 Merge topic 'xcode-framework-system-includes'
7d99cff236 Xcode: Properly identify frameworks with system includes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !6815
2022-01-06 10:12:26 -05:00
Brad King
138aabfa9d Merge topic 'vs-csharp-dotnet-sdk'
0eea32a376 VS: Add DOTNET_SDK property to generate SDK-style C# projects
a450cc9533 VS: Set ResolveNugetPackages to false for ALL_BUILD and ZERO_CHECK
fa76e5d194 cmVisualStudio10TargetGenerator: Factor out helper for classic MSBuild project

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6634
2021-12-22 08:56:22 -05:00
Brad King
69eb5b2421 Merge topic 'doc-list-non-existent'
b573a732dc Tests: add tests to check claims in the documentation
b151db01f9 Help: mention non-existent case for list(PREPEND)
b3a249c2cb Help: clarify range for list(INSERT), mention nonexistent / empty case
b6fdcb3df0 Help: clarify description of list(INSERT)
e55f473ea9 Help: clarify that list(APPEND) on a non-existent list creates it

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6824
2021-12-22 08:53:02 -05:00
Brad King
217f363cac Merge topic 'link-only-targets'
37af6c3311 target_link_libraries: Optionally require only target names
5134f099a3 cmGeneratorTarget: Factor out message about reasons for a missing target
37a25072ea Tests: Rename RunCMake.{CMP0028 => LinkItemValidation}

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !6821
2021-12-22 08:52:13 -05:00
Gregor Jasny
7d99cff236 Xcode: Properly identify frameworks with system includes
Check the complete include path for being a system include, not
the derived framework search path. The code for Ninja and Makefile
generators does exactly the same.

Fixes: #23011
2021-12-22 11:38:52 +01:00
Sumit Bhardwaj
0eea32a376 VS: Add DOTNET_SDK property to generate SDK-style C# projects
Changes in cmVisualStudio10TargetGenerator::Generate to write .Net
SDK-style project for VS generators VS 19 and above. Also adds
documentation and tests.

Issue: #20227
2021-12-21 09:35:49 -08:00
Adriaan de Groot
b573a732dc Tests: add tests to check claims in the documentation
- list commands APPEND, PREPEND, INSERT treat non-existent
  lists as empty and use that value, creating a new list
  variable in the process.
2021-12-21 10:55:50 -05:00
Brad King
37af6c3311 target_link_libraries: Optionally require only target names
Optionally verify that items in `LINK_LIBRARIES` and
`INTERFACE_LINK_LIBRARIES` that can be target names are actually target
names.  Add a `LINK_LIBRARIES_ONLY_TARGETS` target property and
corresponding `CMAKE_LINK_LIBRARIES_ONLY_TARGETS` variable to enable
this new check.

Fixes: #22858
2021-12-20 12:14:07 -05:00
Brad King
37a25072ea Tests: Rename RunCMake.{CMP0028 => LinkItemValidation}
Generalize the test name to prepare for cases beyond CMP0028.
2021-12-20 09:56:51 -05:00
Brad King
6fda93faf8 FindGLUT: Provide modern-named GLUT_INCLUDE_DIRS result variable
Previously this module only provided `GLUT_INCLUDE_DIR`, which does not
follow the modern naming convention documented in `cmake-developer(7)`.

Issue: #23018
2021-12-20 09:53:33 -05:00
Brad King
af9fcbd006 Merge topic 'improve-CMP0028-messages'
ea050286e7 CMP0028: Report the target whose link interface has an offending item
a97c92e46e CMP0028: Report backtrace to link item rather than target creation
0dcbf4ab58 cmGeneratorTarget: Record when imported target link iface libs are done

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !6810
2021-12-20 09:32:42 -05:00
Brad King
b2d764fea1 Merge topic 'FindGLUT-include-dirs'
ae6b25d920 FindGLUT: Provide legacy GLUT_INCLUDE_DIR result in pkg-config code path

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6814
2021-12-20 09:30:01 -05:00
Brad King
f5f73e5ac1 Merge topic 'test-vsnormal-allow-intel'
d7ae61cde6 Tests: In RunCMake.GeneratorToolset accept Intel platform toolsets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6811
2021-12-20 09:21:33 -05:00
Brad King
ae6b25d920 FindGLUT: Provide legacy GLUT_INCLUDE_DIR result in pkg-config code path
Since commit f90d15458a (FindGLUT: Use pkg-config to find flags if
available, 2021-06-11, v3.22.0-rc1~469^2) we return early if pkg-config
provides the information.  During review of that commit, code to
populate the legacy `GLUT_INCLUDE_DIR` result variable was removed from
that code path.  Add code to provide it.

Also fix the test case to use `GLUT_INCLUDE_DIR`, the result variable
documented officially by the module.

Fixes: #23018
2021-12-17 15:17:29 -05:00
William R. Dieter
d7ae61cde6 Tests: In RunCMake.GeneratorToolset accept Intel platform toolsets
The RunCMake.GeneratorToolset test expected platform toolsets to have a
name beginning with 'v' followed by one or more decimal digits, as all
the Microsoft platform toolsets follow that naming convention.
The Intel platform toolsets begin with "Intel" and have various
additional strings depending on the compiler version.

This change accepts the toolsets delivered by Intel in addition to those
from Microsoft.

Signed-off-by: William R. Dieter <william.r.dieter@intel.com>
2021-12-17 09:27:17 -05:00
Brad King
594f81966d Merge topic 'filter-debug-find'
d7b18895bc cmake: Add filtered debug-find options

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex <leha-bot@yandex.ru>
Merge-request: !6778
2021-12-17 08:56:37 -05:00
John Parent
d7b18895bc cmake: Add filtered debug-find options
Add a `--debug-find-pkg=` option to debug find calls for specific
packages.

Add a `--debug-find-var=` option to debug find calls for specific
return variables.

Fixes: #21880
2021-12-17 08:55:21 -05:00
Brad King
ea050286e7 CMP0028: Report the target whose link interface has an offending item
Previously items linked via the link interface of a dependency were
reported in CMP0028 messages as if directly linked by a target.
Clarify the messages to indicate that an offending item is actually
in the link interface of a given target, regardless of its consumer.

Move the check to the end of generation and look through the final set
of link implementations and link interfaces that were used for
generation.  This avoids repeating messages on link interfaces that
have multiple consumers.
2021-12-16 16:43:17 -05:00
Brad King
a97c92e46e CMP0028: Report backtrace to link item rather than target creation
Now that we have proper backtraces for both `LINK_LIBRARIES` and
`INTERFACE_LINK_LIBRARIES` entries, we can report them in error
messages.
2021-12-16 12:45:27 -05:00
Brad King
d5026daa9e Merge topic 'link-interface-backtrace'
1d709ea2f5 cmGeneratorTarget: Propagate backtraces from INTERFACE_LINK_LIBRARIES
a84a62e0a7 cmTarget: Record backtraces for INTERFACE_LINK_LIBRARIES

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !6805
2021-12-16 10:38:56 -05:00
Brad King
4663c82f9e Merge topic 'msvc_cuda_propagate_defines_to_ptx'
574b492b47 CUDA: Visual Studio Generator propagates definitions for PTX files

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6802
2021-12-16 10:27:21 -05:00
Brad King
1d709ea2f5 cmGeneratorTarget: Propagate backtraces from INTERFACE_LINK_LIBRARIES 2021-12-15 12:29:47 -05:00
unknown
574b492b47 CUDA: Visual Studio Generator propagates definitions for PTX files
From CUDA 9.0 to CUDA 11.4 the CUDA Visual Studio integration
defines omitted user defines from PTX generation.

With CUDA 11.5 this has been resolved, so we backport the fix
to allow for consistent behavior when using CMake
2021-12-14 14:55:48 -05:00
Brad King
25a300b76e Merge topic 'fix-list-transform-invalid-index-crashes'
7dd3e99270 cmListCommand: Handle invalid FOR selector ranges

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !6786
2021-12-14 09:36:08 -05:00
Brad King
f22aa2f466 Merge topic 'tests_if_version'
1a813273ca Tests: Add more version comparison tests

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6791
2021-12-09 10:40:11 -05:00
Brad King
78c20892bf Merge topic 'ctest-add_subdirectory'
7c5a120c38 Tests: Add case covering both ctest subdirectory commands
04deda1d2a CTest: Extract common implementation of add_subdirectory and subdirs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6795
2021-12-09 10:39:20 -05:00
Nick Muggio
7dd3e99270 cmListCommand: Handle invalid FOR selector ranges
Fixes crashes involving invalid ranges specified in list(TRANSFORM ...
FOR ...) calls.
* Report error when step is not positive
* Report error when start is after stop

Fixes: #22985
2021-12-08 20:54:04 -05:00
Paweł Bylica
1a813273ca Tests: Add more version comparison tests 2021-12-08 12:05:36 -05:00
Brad King
7c5a120c38 Tests: Add case covering both ctest subdirectory commands
CTest re-implements the `subdirs` and `add_subdirectory` commands.
Verify that they both work.
2021-12-08 11:36:50 -05:00
Brad King
c749982c13 cmTargetPropertyComputer: Simplify by restoring use of cmMakefile
Logically revert commit 390a7d8647 (cmTargetPropertyComputer: Implement
GetProperty without cmMakefile, 2016-10-13, v3.8.0-rc1~445^2~9).
It relied on using `cmListFileBacktrace` to get a scope in which to
look up policies.

This does remove a backtrace from `LOCATION` property errors at generate
time, but the backtrace we reported before was incorrect.  It pointed at
the addition of a target, not to the reference to the property.
2021-12-08 10:03:48 -05:00
Brad King
3d378541bb cmMessenger: Adopt backtrace printing functions
Move backtrace printing functions from `cmListFileBacktrace` over to
`cmMessenger`, their primary caller.  Thread `cmMessenger` instances
through APIs needed to update other call sites.
2021-12-08 10:03:48 -05:00
Brad King
79afbb2bb3 Merge topic 'lib-arch-no-usr'
d4ba945c48 CMakeParseLibraryArchitecture: Fix parsing /lib/<arch> implicit object path

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6790
2021-12-07 09:37:29 -05:00
Raphael Gozzo
d4ba945c48 CMakeParseLibraryArchitecture: Fix parsing /lib/<arch> implicit object path
The current regular expression is able to match `/usr/lib/<arch>`,
`/usr/usr/lib/<arch>`, `/usr/usr/usr/lib/<arch>`, ... but not
`/lib/<arch>`.

This behavior ends up causing the detected architecture to
be x86_64-pc-linux-gnu when the Clang compiler is installed on
a "non-system" location (like /opt/llvm-13) which, in turn, makes
almost every 'find_library()' fail because the correct
architecture is x86_64-linux-gnu.

This is due to a typo in commit 764606e256 (CMakeDetermineCompilerABI:
Extract lib arch from implicit object file paths, 2021-04-05,
v3.20.1~10^2), which used `+` instead of `?`.
2021-12-06 16:47:29 -05:00
Brad King
b3f1f568d3 Merge topic 'ci-vs-managed'
69419c5870 ci: Enable more VS tests that use managed code

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6782
2021-12-06 15:16:00 -05:00
Brad King
69419c5870 ci: Enable more VS tests that use managed code
A couple of VS tests were conditioned on `NOT CMAKE_GENERATOR_TOOLSET`,
but in CI jobs with VS we always set `CMAKE_GENERATOR_TOOLSET`.  Make
the condition specific to excluding the `v90` toolset, which was its
original intention anyway.
2021-12-03 09:09:04 -05:00
Brad King
9ecb24b5a7 Merge topic 'vs-csproj-scripts'
13a7ae2194 VS: Revert "Add missing label in C# project-build events"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6781
2021-12-03 08:54:34 -05:00
Brad King
13a7ae2194 VS: Revert "Add missing label in C# project-build events"
Revert commit b284a21fee (VS: Add missing label in C# project-build
events, 2021-09-03, v3.22.0-rc1~156^2).  The change broke cases using
multiple successful custom commands.  Revert it pending further
investigation into the interaction of the generated script code with
`Microsoft.Common.CurrentVersion.targets`, and whether this is needed
for all managed projects or just C# projects.

Also add a test covering the case that was broken.

Fixes: #22964
Issue: #21440
2021-12-02 18:06:39 -05:00
Brad King
57349a4851 Merge topic 'rpath-unrecognized-format'
643fc46bdc file(RPATH): Restore tolerance of unknown formats if new RPATH is empty
5596cba7dc cmSystemTools: Remove unnecessary mark-as-used casts to void

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6779
2021-12-02 11:45:38 -05:00
Brad King
643fc46bdc file(RPATH): Restore tolerance of unknown formats if new RPATH is empty
Since commit 2e1149874d (cmSystemTools: Support multiple binary formats,
2021-06-14, v3.22.0-rc1~575^2) the `file(RPATH_...)` operations fail on
files that are not ELF or XCOFF format.  Previously the RPATH operations
tolerated files of unknown format if the goal was to produce a file with
an empty RPATH.  Restore this tolerance in order to support setting an
empty RPATH on GNU ld scripts.

Fixes: #22963
2021-12-01 12:58:11 -05:00
Dmitry Marakasov
c07bba2730 GNUInstallDirs: Update CMAKE_INSTALL_MANDIR for FreeBSD
FreeBSD has switched from PREFIX/man ro PREFIX/share/man
see https://cgit.freebsd.org/ports/tree/CHANGES entry 20200115.

Fixes: #22883
2021-11-30 12:16:37 -05:00
Brad King
4133c426c2 Merge topic 'env-init-configs'
5b1ed2a646 try_compile: Do not use CMAKE_BUILD_TYPE or CMAKE_CONFIGURATION_TYPES env vars

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6755
2021-11-23 09:55:17 -05:00
Brad King
5b1ed2a646 try_compile: Do not use CMAKE_BUILD_TYPE or CMAKE_CONFIGURATION_TYPES env vars
Since:

* commit e216b9bbd3 (cmake: Allow CMAKE_BUILD_TYPE to be set by
                     environment variable, 2021-06-29, v3.22.0-rc1~503^2~1)
* commit ef56eefc9b (cmake: Allow CMAKE_CONFIGURATION_TYPES to be set by
                     environment variable, 2021-06-29, v3.22.0-rc1~503^2)

the environment variables are supposed to provide defaults for settings
the user otherwise can control via cache entries.  However, they
accidentally affect `try_compile` projects too, which are supposed to be
programmatically controlled.

Fixes: #22935
2021-11-22 12:50:42 -05:00
Brad King
df123f7d5f Merge topic 'FindGTest-target-for-gmock'
50bf457a0d FindGTest: Add target for gmock library

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6632
2021-11-22 11:53:19 -05:00
Eero Aaltonen
50bf457a0d FindGTest: Add target for gmock library
`googlemock` has been absorbed into the
[googletest](https://github.com/google/googletest) project and is built
and installed from the same source tree.

As GTest may be built with or without GMock, skip GMock if it is not
present.

Do not provide result variables for GMock.  They are not provided by
upstream GTest's CMake Package Configuration File.

Also update the test case to cover linking to `GTest::gmock`.
2021-11-22 11:23:39 -05:00
Brad King
1cbb956b34 Merge topic 'GNUInstallDirs-multiarch-prefixes'
dd9584b352 GNUInstallDirs: Apply Debian multiarch LIBDIR to more prefixes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6748
2021-11-22 11:20:43 -05:00
Brad King
454344f35d Merge branch 'UseSWIG-create-workingdir' into release-3.22
Merge-request: !6750
2021-11-22 11:11:56 -05:00
Brad King
97ea8d30ed Merge topic 'UseSWIG-create-workingdir'
7224eb5185 UseSWIG: ensure directory for depfile exists

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6750
2021-11-22 11:10:15 -05:00
Marc Chevrier
7224eb5185 UseSWIG: ensure directory for depfile exists
When `Visual Studio` and `Xcode` generators are used, directory for depfile
is not implicitely created by CMake when OUTFILE_DIR option is used.

Fixes: #22932
2021-11-19 17:50:52 +01:00