Commit Graph

3915 Commits

Author SHA1 Message Date
Brad King
7024596a26 Tests: Fix testing CMAKE_CUDA_ARCHITECTURES=OFF with Clang
Clang does not automatically choose an architecture supported
by the SDK.  The `OFF` value is meant for users to provide their
own architecture flags, so provide one as part of the test.
2022-03-10 07:10:38 -05:00
Robert Maynard
2a79b647fa CUDA: Restore support for CMAKE_CUDA_ARCHITECTURES=OFF
Fixes: #23309
2022-03-09 12:30:12 -05:00
Kyle Edwards
11ea24e590 Tests: Disable CMAKE_SYSTEM_PROGRAM_PATH in IgnorePrefixPath test
Some systems set CMAKE_SYSTEM_PROGRAM_PATH, which pollutes the
environment for this test. Erase it before executing the test to get
a clean environment.

Fixes: #23300
2022-03-08 17:38:07 -05:00
Brad King
11c25ae6ae Merge topic 'cmake-presets-file-dir' into release-3.23
f54507c2f6 CMakePresets.json: Add ${fileDir} macro

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Gerhard Olsson <gerhard.nospam@gmail.com>
Merge-request: !7051
2022-03-08 16:03:14 -05:00
Kyle Edwards
f54507c2f6 CMakePresets.json: Add ${fileDir} macro
Fixes: #23214
2022-03-07 18:03:16 -05:00
Brad King
eca72dab8b Tests: Make RunCMake.CMP0125 robust to external filesystem content
Revise the test from commit 08db1341a6 (find_*: ensure consistent
behavior for cache variables, 2021-05-03, v3.21.0-rc1~177^2) to avoid
searching outside the test directories.

Fixes: #23299
2022-03-07 11:40:30 -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
Brad King
47d197745a Tests: Simplify RunCMake.{if,while} unbalanced parenthesis cases 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
50b6744c66 Merge topic 'cuda-arch-all' into release-3.23
dae3ad08fa Tests: Add cases for CMAKE_CUDA_ARCHITECTURES={all,all-major}
5c1f5357b0 VS: Fix CUDA compiler id with CMAKE_CUDA_ARCHITECTURES={all,all-major}

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7035
2022-03-03 11:48:00 -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
Kyle Edwards
b357d334fc target_sources(): Enforce stricter requirements for FILE_SET name
Fixes: #23286
2022-03-03 10:17:10 -05:00
Brad King
dae3ad08fa Tests: Add cases for CMAKE_CUDA_ARCHITECTURES={all,all-major}
The `CudaOnly.All` test only sets these in project code after CUDA is
enabled.  Add another case to test the values during compiler detection.

Issue: #23161
2022-03-02 15:51:45 -05:00
Brad King
d2e9478321 Tests: Add RunCMake.CommandLine ExplicitiDirs explicit work directory
Verify that the work directory is not selected as the source or build
tree.

Issue: #23285
2022-03-02 12:21:34 -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
4091d5c58c Tests: Verify RunCMake.CommandLine ExplicitDirs source/build dirs 2022-03-02 12:21:03 -05:00
Brad King
1b97f8f35c Tests: Clarify RunCMake.CommandLine ExplicitDirs case names 2022-03-02 10:53:41 -05:00
Brad King
f0f4390325 Merge topic 'doc-presets-v4' into release-3.23
6404751176 Help: Improve wording and structure related to preset includes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7028
2022-03-02 07:49:44 -05:00
Craig Scott
6404751176 Help: Improve wording and structure related to preset includes
Encourage placing preset includes near the beginning of a preset
file and ensure the example shows that usage. Move the prose
discussing includes to its own section to improve discoverability
and break up paragraphs to make each main point harder to miss.

Also clarify ${sourceDir} to remove any ambiguity with regard to
its meaning in included files.

Issue: #23214
2022-03-02 11:37:57 +11:00
Kyle Edwards
ad41c9cd11 target_sources(): Prohibit FILE_SET on custom targets
Fixes: #23262
2022-02-28 17:21:04 -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
Brad King
ae5f8684f9 Merge topic 'file-set-no-exist' into release-3.23
058b8a0bfb install(): Properly ignore FILE_SETs that don't exist

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7000
2022-02-18 08:57:31 -05:00
Brad King
e9832cc298 Merge topic 'test-qt-disable' into release-3.23
5bfff3c750 Tests: Add missing guards on Qt4 and Qt5 tests

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6998
2022-02-18 08:52:48 -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
5bfff3c750 Tests: Add missing guards on Qt4 and Qt5 tests
Add missing `CMake_TEST_Qt{4,5}` conditions on Qt4 an Qt5 tests.
Configuring CMake with `-DCMake_TEST_Qt5=OFF` should prevent any
attempt to search for Qt5.

Fixes: #23239
2022-02-17 11:00:25 -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
67f97f5478 Tests: Add RunCMake helper to run cmake with raw execute_process args 2022-02-16 12:10:19 -05:00
Brad King
2adea60f45 Merge topic 'GoogleTest-discovery-fix-escaping' into release-3.23
61929f936f GoogleTest: Fix escaping in test names

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6965
2022-02-14 09:58:00 -05:00
Evgeniy Shcherbina
61929f936f GoogleTest: Fix escaping in test names
Due to add_command() being a macro it introduced excessive and
nonobvious escaping in different parts of the script. Because of
one of such places the resulting script would have an erroneous
${TEST_LIST} if the user data (in test parameters) had a semicolon.

To eliminate this non-obvious escaping, add_command() was converted
to function. Updated the escaping accordingly.

Fixes: #23059
2022-02-11 09:03:40 -05: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
2f43527574 Tests: Improve order of RunCMake.find_package cases
Sort recently added cases among similar-named cases.
2022-02-10 15:25:05 -05:00
Brad King
fe5b2e8beb Merge topic 'doc-if-AND-OR' into release-3.23
41adfc6b04 Help: Clarify precedence of AND and OR in 'if' conditions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6970
2022-02-10 09:11:13 -05:00
Brad King
5b480172c3 Merge topic 'clang-cross-compile-windows-pdb' into release-3.23
641cb1093b Windows/Clang: Support PDB when cross-compiling

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex <leha-bot@yandex.ru>
Merge-request: !6959
2022-02-10 09:09:09 -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
Brad King
41adfc6b04 Help: Clarify precedence of AND and OR in 'if' conditions
The wording update in commit b74819e4fe (Help: Format 'if' command
documentation, 2013-12-18, v3.0.0-rc1~227^2~1) incorrectly implied that
`AND` has higher precedence than `OR`.  Although this is common in many
languages, it has never been true in CMake's implementation.  Revise
the wording to clarify the precedence.

Add a test case demonstrating the order.

Fixes: #23207
2022-02-09 14:24:43 -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
Deniz Bahadir
641cb1093b Windows/Clang: Support PDB when cross-compiling 2022-02-09 00:38:09 +01:00
Brad King
5bf6e57a12 Merge topic 'GoogleTest-discover-type-params' into release-3.23
073dd1bd81 GoogleTest: Change format for typed tests
f28f738bd2 GoogleTest: Fix type param tests for suites with many cases

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6958
2022-02-08 08:35:18 -05:00
Evgeniy Shcherbina
073dd1bd81 GoogleTest: Change format for typed tests
Before it would output a typed test as follows:
  Suit/Type.Case
And now it would be:
  Suit.Case<Type>

In case of NO_PRETTY_TYPES it would simply use the type number
instead of its text representation:
  Suit.Case<0>

The change is introduced to make sure CTest outputs tests in a
similar fashion which is "*Suit.Case*" and angle brackets "<>"
emphasize that we are dealing with a typed (template) kind.
2022-02-07 12:53:17 -05:00
Evgeniy Shcherbina
f28f738bd2 GoogleTest: Fix type param tests for suites with many cases
When there were many cases (two digits or more) the "prettier" would
fail to recognize the pretty part leaving the test name unprocessed.
The fix made sure the processing would work correctly, irrespective
of the case number.

Before the fix, for the following input:
TypedSuite/1.  # TypeParam = int
  case
TypedSuite/10.  # TypeParam = char
  case
The output would be:
TypedSuite/int.case
TypedSuite/10.  # TypeParam = char.case

Now the output will be:
TypedSuite/int.case
TypedSuite/char.case
2022-02-07 12:53:16 -05:00
Brad King
01b89d2547 Merge topic 'ep-patch-USES_TERMINAL' into release-3.23
cbb87e0a2c ExternalProject: Add support for USES_TERMINAL_PATCH keyword

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6940
2022-02-04 08:18:12 -05:00