3944 Commits

Author SHA1 Message Date
Brad King
a12050666c Tests: Add case for ninja with non-ascii chars
Issue: #24089
2022-10-26 15:25:45 -04:00
Brad King
90287792b6 Tests: Avoid running C++11 test on GNU < 4.7
The test added in commit 50e90e2828 (try_compile: Honor CMP0128 setting
in test project, 2022-10-18, v3.25.0-rc2~4^2) requires that the compiler
support C++11 mode, so do not run it on GNU compilers that are too old.
2022-10-24 12:04:57 -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
Robert Maynard
261fa5db39 cmake: In -P mode ignore extra paths on the command line
Fixes: #23748
2022-07-22 13:53:52 -04:00
Kyle Edwards
29c7546a61 cmGlobalGenerator: Only compute build files for all targets
If we're creating generation objects for imported targets only, we
don't need the export sets. Only compute build file generators
if generating for all targets.

Fixes: #23709
2022-07-13 11:34:34 -04:00
Brad King
529004738a Merge branch 'file-set-crash' into release-3.23
Merge-request: !7420
2022-06-30 08:22:27 -04:00
Kyle Edwards
3fee5398bd install(EXPORT): Check for missing file sets at generate time
Missing file sets were originally checked at configure time in
install(TARGETS ... EXPORT), but were not checked at generate time. If
a file set was added after install(TARGETS ... EXPORT) was called,
an abortion error was thrown. Check again at generate time to gracefully
display an error message instead of crashing.

Fixes: #23680
2022-06-29 15:05:32 -04:00
Brad King
65f2e9263c Merge branch 'xcode-14' into release-3.23
Merge-request: !7350
2022-06-11 05:37:53 -04:00
Brad King
627c08e28b Tests: Teach RunCMake to ignore Xcode DVTSDK warnings
On some Xcode versions, `xcodebuild` may warn:

    ... xcodebuild[...]  [MT] DVTSDK: Warning: SDK path collision for path ...

Teach RunCMake to drop such incidental lines before matching against
expected output.
2022-06-10 14:24:03 -04:00
Brad King
7e4d6bbe02 Merge topic 'ci-xcode-13.3' into release-3.23
65b6daf776 gitlab-ci: update macOS jobs to use Xcode 13.3
94361a1309 Tests: Ignore all classes in Xcode internal objc warnings
da9f864513 Tests: Teach RunCMake to ignore Xcode extension point warnings

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7204
2022-04-26 11:12:51 -04:00
Brad King
f48047251f Merge branch 'ci-xcode-13.3' into release-3.22
Merge-request: !7204
2022-04-26 11:12:28 -04:00
Gregor Jasny
94361a1309 Tests: Ignore all classes in Xcode internal objc warnings
Xcode on Apple Silicon warns not only about AMSupportURL classes
but also many more.
2022-04-25 15:52:15 -04:00
Brad King
da9f864513 Tests: Teach RunCMake to ignore Xcode extension point warnings
On some Xcode versions, `xcodebuild` may warn:

    ... xcodebuild[...] Requested but did not find extension point with
                        identifier ...

Teach RunCMake to drop such incidental lines before matching against
expected output.
2022-04-25 14:35:11 -04:00
Ben Boeckel
9ee47188c0 cmExportBuildFileGenerator: handle genex-wrapped source paths
Previously a fileset with `$<$<CONFIG:Debug>:some_file>` would show up
as-is (with escaping) in the build directory export. Instead, evaluate
all fileset entries as generator expressions and list them as they are
similar to the installation information.
2022-04-18 13:43:18 -04:00
Ben Boeckel
60fab8a6e0 cmInstallCommand: tweak error message
Not all filesets need to be installed; just those that are visible on
the target's interface. Clarify the error message.
2022-04-15 20:44:53 -04:00
Kyle Edwards
d0d09aa29f FILE_SET: Make INTERFACE libraries with HEADER_SETS participate in buildsystem
If an INTERFACE library has HEADER_SETS, and its header sets contain
files generated by a custom command, the library needs to participate in
the buildsystem so that the files will be generated.

Fixes: #23422
2022-04-14 09:17:54 -04:00
Brad King
56a11b2f64 Merge topic 'file-set-repr-improvements' into release-3.23
5fa15ec9f3 Help: Document that target_sources defines [INTERFACE_]HEADER_SETS
c5d4812f20 cmTarget: make HEADER_SETS and INTERFACE_HEADER_SETS read-only
05783b168d cmFileSet: store visibility with the fileset

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7168
2022-04-12 10:05:25 -04:00
Brad King
4135d726d4 Merge topic 'correct_list-presets_parsing' into release-3.23
45299a8f9b cmake: --list=presets=[type] doesn't generate incorrect warnings

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7164
2022-04-12 08:16:00 -04:00
Brad King
4471f2b0d7 Merge topic 'xcode-pch' into release-3.23
476c6a8910 PCH: Fix Xcode non-pch language exclusion
fcf1fcfd0c Tests: Ignore all classes in Xcode internal objc warnings

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7166
2022-04-12 08:10:47 -04:00
Cristian Adam
476c6a8910 PCH: Fix Xcode non-pch language exclusion
Fix a regression caused by commit bbcdac4e5d (PCH: Fix all-language
precompile header support in Xcode, 2021-08-07, v3.22.0-rc1~140^2).

Fixes: #23138
2022-04-11 14:16:33 -04:00
Gregor Jasny
fcf1fcfd0c Tests: Ignore all classes in Xcode internal objc warnings
Xcode on Apple Silicon warns not only about AMSupportURL classes
but also many more.
2022-04-11 14:15:52 -04:00
Ben Boeckel
c5d4812f20 cmTarget: make HEADER_SETS and INTERFACE_HEADER_SETS read-only
There is no reason to allow these properties to be manipulated by user
code. Instead, use the stored visibility on the fileset objects to
derive what these properties should contain.
2022-04-11 14:06:15 -04:00
Robert Maynard
45299a8f9b cmake: --list=presets=[type] doesn't generate incorrect warnings
Fixes #23407
2022-04-11 10:46:03 -04:00
Craig Scott
a10fc754a6 CheckSourceCompiles: Avoid linker warning with -fembed-bitcode
When the Apple linker sees -headerpad_max_install_names and
bitcode is enabled with a flag like -fembed-bitcode, it issues a warning
and ignores the -headerpad_max_install_names flag. This causes
unrelated compiler and linker flag checks to fail for valid flags.
In f745e0497e (CheckCompilerFlags: Catch linker warning about ignored
flags, 2022-01-03), we started detecting linker warnings, which caused
a regression for projects that were setting -fembed-bitcode in their
CMAKE_CXX_FLAGS or similar. Prevent that regression by removing
the -headerpad_max_install_names linker flag when we know it will
warn and be ignored anyway.

Fixes: #23390
Issue: #23408
2022-04-09 21:51:09 +10:00
Brad King
9dd585d12c CheckCompilerFlag: Fix regression in locale environment preservation
Fix a typo from commit 660e0d80ae (internal/CheckCompilerFlag: rely on
common configuration, 2022-01-12, v3.23.0-rc1~124^2~1) that caused
locale environment variables to not be restored after they are set
during the check.
2022-04-07 15:07:48 -04:00
Kyle Edwards
f779f8c0ad FILE_SET: Forbid adding header sets to Apple FRAMEWORK libraries
The feature needs a specialized implementation to place headers
in the right place inside frameworks.  To avoid silently doing
the wrong thing, make this case an error for the 3.23 series.

Issue: #23386
2022-04-07 09:26:58 -04:00
Brad King
624ec3692f GNUInstallDirs: Revert "Apply Debian multiarch LIBDIR to more prefixes"
Revert commit dd9584b352 (GNUInstallDirs: Apply Debian multiarch LIBDIR
to more prefixes, 2021-11-19, v3.23.0-rc1~323^2).  There are separate
problems with activating multiarch `LIBDIR` for each prefix it added:

* Prefix `/` is often used to stage an installation with `DESTDIR`
  for inclusion in a tarball package or similar.

* Prefix `/usr/local` is the default `CMAKE_INSTALL_PREFIX`, causing
  the multiarch `LIBDIR` to be cached after the first configuration,
  even if the prefix changes later.

Revert the change for now, except for the documentation update.
Further discussion will be needed to select a way to enable
multiarch `LIBDIR` for `/` and `/usr/local`.

Fixes: #23365
Issue: #19698
2022-03-30 11:51:01 -04:00
Kyle Edwards
26caa97057 define_property(): Change constraints of INITIALIZE_FROM_VARIABLE
Remove the requirement that the variable name have a prefix while
keeping the suffix requirement. Require that the property name
contains an underscore. Update docs and tests accordingly.

Fixes: #23340
2022-03-23 16:39:32 +11:00
Robert Maynard
b44ad7992a cmake: Always prefer the last source directory provided
Fixes: #23334
2022-03-17 15:23:01 -04:00
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