Commit Graph

9950 Commits

Author SHA1 Message Date
Craig Scott
dd3482f675 cmTargetPropCommandBase: Restore ArgumentFlags enum value bool logic
The values of the cmTargetPropCommandBase::ArgumentFlags enum
are combined in boolean OR and AND operations in various places.
That used to be valid, but some values were added over time which did
not preserve support for such boolean logic. Update the enum values
such that they are increasing powers of 2 to restore that capability.

Fixes: #24199
2022-11-27 20:17:32 +11:00
Brad King
c924d33bec Merge topic 'cxxmodule-module-support-tweaks'
c53748cc09 Tests/RunCMake/CXXModules: mark IMPORTED targets as INTERFACE
a971fcfde7 cmNinjaNormalTargetGenerator: use `cmStrCat`
b7509d6bf8 cmNinjaNormalTargetGenerator: fix grammar in verbose comment
0015cb95de cmGlobalNinjaGenerator: fix comment typo

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7943
2022-11-23 07:10:52 -05:00
Brad King
af937d2933 Merge topic 'try_compile-copy-config'
80fc564dd7 try_compile: Restore COPY_FILE with CMAKE_TRY_COMPILE_CONFIGURATION

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Merge-request: !7948
2022-11-23 07:09:10 -05:00
Brad King
7c462e36c9 Merge topic 'XCode-XCODE_LINK_BUILD_PHASE_MODE-and-LINK_LIBRARY-genex'
61075d2d7b XCode: ensure LINK_LIBRARY genex is usable with XCODE_LINK_BUILD_PHASE_MODE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7947
2022-11-23 07:08:01 -05:00
Brad King
80fc564dd7 try_compile: Restore COPY_FILE with CMAKE_TRY_COMPILE_CONFIGURATION
Since commit 0c141b0393 (try_compile: Record output location instead of
reverse computing it, 2022-08-31, v3.25.0-rc1~154^2) we always look for
the "Debug" configuration's output binary from the test project.
Restore looking for the `CMAKE_TRY_COMPILE_CONFIGURATION`.

Fixes: #24180
2022-11-22 11:26:28 -05:00
Marc Chevrier
61075d2d7b XCode: ensure LINK_LIBRARY genex is usable with XCODE_LINK_BUILD_PHASE_MODE
Fixes: #24176
2022-11-22 16:44:45 +01:00
Brad King
e1b757602c Merge topic 'find_dependency-dedup'
fb9a3d0c7d find_dependency: Avoid repeating identical dependency searches
5fbda0f572 find_dependency: Unset temporary variables before returning
591b75ee17 Tests: Add case covering transitive find_dependency calls

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7936
2022-11-22 09:50:12 -05:00
Brad King
62172b4ab7 Merge topic 'custom-command-comment-genex'
26d813092b add_custom_{command,target}: add genex support for COMMENT
60a5a39022 cmCustomCommandGenerator: refactor GetComment to return std::string

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7887
2022-11-22 09:47:59 -05:00
Ben Boeckel
c53748cc09 Tests/RunCMake/CXXModules: mark IMPORTED targets as INTERFACE
Now that `Ninja` generators will know to generate rules for `IMPORTED`
targets, mark these as `INTERFACE` to avoid requirements of actual
artifacts.
2022-11-21 18:22:00 -05:00
Brad King
e69251c828 Merge topic 'xcode-ios-extensionkit'
b99c386122 Xcode: Allow bundling extensionkit extensions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7900
2022-11-21 10:06:20 -05:00
Brad King
55e3168dc4 Merge topic 'lang-std-flag-order'
a1c20b08b4 cmLocalGenerator: Inline AddCompilerRequirementFlag in only call site
914571a042 Place language standard flags just after CMAKE_<LANG>_FLAGS
ad16ae5c70 VS: Recognize -std: flag in CMAKE_C_FLAGS in target with C++ sources

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7931
2022-11-21 10:03:35 -05:00
Brad King
fa7afe5eb3 Merge topic 'cxx-scanning-properties'
a02d792c6e cxxmodules: add properties to control scanning
008c09d6db cmNinjaTargetGenerator: factor out determining the fileset of a source

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7935
2022-11-21 10:00:12 -05:00
Brad King
38660bfc20 Merge topic 'test-file-download'
28513a5fba Tests: Honor CMake_TEST_NO_NETWORK in RunCMake.file-DOWNLOAD
52b9c7b958 Tests: Move CMake.FileDownload cases into RunCMake.file-DOWNLOAD
9dda7c276c Tests: Factor out common helper in RunCMake.file-DOWNLOAD cases
d6af54c473 Tests: Factor out a RunCMake.file-DOWNLOAD test

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7937
2022-11-21 09:52:29 -05:00
Peter Würth
26d813092b add_custom_{command,target}: add genex support for COMMENT
Evaluate and expand generator expressions in the `COMMENT` argument of
the `add_custom_command()` and `add_custom_target()` commands.
This allows to include generator expressions, e.g. a targets location
$<TARGET_...> or the current configuration $<CONFIG>, in the build-time
messages.

Fixes #22507
2022-11-19 13:32:56 +01:00
Russell Greene
b99c386122 Xcode: Allow bundling extensionkit extensions
Fixes: #24150
2022-11-18 13:58:03 -06:00
Brad King
914571a042 Place language standard flags just after CMAKE_<LANG>_FLAGS
Previously we added the language standard flag near the end of all
options, even after those added by `add_compile_options` and friends.
However, on some compilers such as MSVC, the `-std` flag may reset
defaults for flags that precede it on the command line.  Move the
language standard flag to before all other flags that CMake adds for
other abstractions, and before those added by `add_compile_options`.

`CMAKE_<LANG>_FLAGS` should still precede the language flags though,
because they are meant to be treated as language-wide modifications to
the compiler defaults, similar to `$CC $CFLAGS`.

Fixes: #23860
Fixes: #24170
2022-11-18 11:44:52 -05:00
Brad King
fb9a3d0c7d find_dependency: Avoid repeating identical dependency searches
Since commit 37da6af17d (find_dependency: Always search dependencies,
2019-03-29, v3.15.0-rc1~301^2) we search for a package every time it is
encountered in the transitive dependency graph traversal, even if it has
been found before.  This was done in case a new visit to a given package
requests different components than a previous visit.  However, it also
causes a lot of repeat processing that is unnecessary in the common case
that all calls share the same set of components (often none).

Restore the logic to avoid repeating the search for an already-found
package.  Handle differences in components by de-duplicating based on
the complete `find_package` call arguments.

Fixes: #23685
2022-11-18 10:31:19 -05:00
Brad King
591b75ee17 Tests: Add case covering transitive find_dependency calls
Issue: #23685
2022-11-18 10:31:19 -05:00
Brad King
4391808712 Merge topic 'file-COPY_FILE-retry'
d34986036f ExternalData: Improve robustness on Windows to copy a data object to a file
efa9eec040 file(COPY_FILE): Add option to retry on Windows if input access fails
fa518188d8 cmSystemTools: Remove unused CopySingleFile overload

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7934
2022-11-18 09:40:13 -05:00
Brad King
1cefd1da95 Merge topic 'ninja-swiftmodule-no-exe'
38c8807c5a Ninja: Avoid re-linking a Swift executable on every build

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7901
2022-11-18 09:34:35 -05:00
Brad King
e558beeef6 Merge topic 'build-local-interface-genex'
38cbf5e15b Genex: Add $<BUILD_LOCAL_INTERFACE:...> genex
37b5c78688 cmGeneratorExpression: Refactor stripExportInterface() to use enum class

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7919
2022-11-18 09:27:35 -05:00
Brad King
1cc936f314 Merge topic 'genex-TARGET_PROPERTY-scope'
8437141b53 Genex: Fix TARGET_PROPERTY lookup scope in transitive usage requirements

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Merge-request: !7928
2022-11-18 09:25:43 -05:00
Brad King
28513a5fba Tests: Honor CMake_TEST_NO_NETWORK in RunCMake.file-DOWNLOAD
Most of the test uses `file://` URLs instead of hitting the network.
However, a case covering an invalid hostname does try to make a real
connection, expecting it to fail DNS resolution.  Turn off that case
if we are asked not to hit the network during testing.
2022-11-18 09:09:36 -05:00
Brad King
52b9c7b958 Tests: Move CMake.FileDownload cases into RunCMake.file-DOWNLOAD
The RunCMake infrastructure is more well-suited to check the results of
each case.  It can also report more precisely what went wrong when a
case fails.
2022-11-18 09:02:15 -05:00
Brad King
9dda7c276c Tests: Factor out common helper in RunCMake.file-DOWNLOAD cases 2022-11-18 09:01:44 -05:00
Ben Boeckel
a02d792c6e cxxmodules: add properties to control scanning
The `CXX_SCAN_FOR_MODULES` property may be used to control scanning for
targets and for source files rather than assuming "C++20 always needs to
be scanned".
2022-11-18 07:54:31 -05:00
Brad King
d6af54c473 Tests: Factor out a RunCMake.file-DOWNLOAD test
Move the `DOWNLOAD-*` cases over from the `RunCMake.file` test.
2022-11-17 16:37:33 -05:00
Brad King
efa9eec040 file(COPY_FILE): Add option to retry on Windows if input access fails
On Windows, a file may be inaccessible for a short time after it is
created.  This occurs for various reasons, including indexing, antivirus
tools, and NTFS's asynchronous semantics.  Add an `INPUT_MAY_BE_RECENT`
option to tell CMake that the input file may have been recently created
so that we can retry a few times to read it.
2022-11-17 15:05:07 -05:00
Evan Wilde
38c8807c5a Ninja: Avoid re-linking a Swift executable on every build
Swift doesn't emit swiftmodules for executables, so we shouldn't put it
in dependency graph.  Ninja sees the "missing" dependency and always
tries to rebuild/re-link the target.
2022-11-17 13:05:22 -05:00
Kyle Edwards
38cbf5e15b Genex: Add $<BUILD_LOCAL_INTERFACE:...> genex
Fixes: #23209
2022-11-17 09:31:27 -05:00
Brad King
14cf3b1039 Merge topic 'file-archive-zstd-compression-level'
ed519b1cba file(ARCHIVE_CREATE): Allow higher compression level for Zstd

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7924
2022-11-17 08:15:04 -05:00
Brad King
311695e319 Merge topic 'test-FindBoost-python-versions'
6b1f933cb8 Tests: Update FindBoost.TestPython for Python 3.11 and 3.12

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7929
2022-11-17 08:06:19 -05:00
Brad King
818ea1e497 Merge topic 'test-FindBoost-python-versions' into release-3.25
6b1f933cb8 Tests: Update FindBoost.TestPython for Python 3.11 and 3.12

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7929
2022-11-17 08:06:18 -05:00
Brad King
8437141b53 Genex: Fix TARGET_PROPERTY lookup scope in transitive usage requirements
When `$<TARGET_PROPERTY:tgt,prop>` is used in an `INTERFACE_*` target
property for usage requirements, it may be evaluated in the context of a
dependent target in another directory.  Look up the `tgt` name in the
directory of the target whose property holds the expression so that
imported targets isolated to that directory are visible.

Fixes: #24163
2022-11-17 07:57:21 -05:00
Brad King
6b1f933cb8 Tests: Update FindBoost.TestPython for Python 3.11 and 3.12
Follow up the python 3.11 and 3.12 support from:

* commit 43844c5d82 (FindPython: Add support for Python 3.11,
                     2021-12-07, v3.22.2~20^2)
* commit ca2877c039 (FindPython: add support for Python 3.12,
                     2022-05-11, v3.23.2~15^2)

with an update for the FindBoost test.
2022-11-16 14:34:07 -05:00
Brad King
d59f861e42 Merge topic 'test-genex-TARGET_PROPERTY'
11b21ae14a Tests: Move some cases to RunCMake.GenEx-TARGET_PROPERTY
a4d0e4ff8f Tests: Prepare RunCMake.GenEx-TARGET_PROPERTY for more independent cases
e855ed7fde Tests: Rename RunCMake.TargetPropertyGeneratorExpressions for consistency

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7918
2022-11-16 09:37:06 -05:00
Brad King
48d52c2cfe Merge topic 'file-copy-error-path'
89b144789d file(COPY_FILE): Report if failure occurred on input or output path
91dd7898ee Merge branch 'upstream-KWSys' into file-copy-error-path
a9c659b1b6 KWSys 2022-11-15 (6c92b9b0)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !7916
2022-11-16 09:36:29 -05:00
Amir Masoud Abdol
ed519b1cba file(ARCHIVE_CREATE): Allow higher compression level for Zstd
This allows the Zstd compression-level to be set between 0-19.  I've
adjusted some of the tests, and error messages to indicates the selected
algorithm, and min/max of its compression-level.

Fixes: #24160
2022-11-16 09:15:01 -05:00
Brad King
b686b58208 Merge topic 'cmp0141-pch-reuse'
94164ea55e CMP0141: Fix PCH REUSE_FROM when MSVC_DEBUG_INFORMATION_FORMAT is empty

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7914
2022-11-16 08:57:04 -05:00
Brad King
11b21ae14a Tests: Move some cases to RunCMake.GenEx-TARGET_PROPERTY
Move some `TARGET_PROPERTY` cases from `RunCMake.GeneratorExpression`.
2022-11-15 10:45:21 -05:00
Brad King
a4d0e4ff8f Tests: Prepare RunCMake.GenEx-TARGET_PROPERTY for more independent cases
The existing cases all need to enable a language.  Move this out of the
`CMakeLists.txt` file and into the individual cases to make room for
other cases that may not need this.
2022-11-15 10:34:00 -05:00
Brad King
e855ed7fde Tests: Rename RunCMake.TargetPropertyGeneratorExpressions for consistency
Rename the test to `RunCMake.GenEx-TARGET_PROPERTY` for consistency with
the other `RunCMake.GenEx-*` test names.
2022-11-15 10:24:07 -05:00
Brad King
89b144789d file(COPY_FILE): Report if failure occurred on input or output path
When we know whether a failure was associated with the input or the
output path, include this information in the error message.
2022-11-15 09:28:45 -05:00
Brad King
eda68d229d Merge topic 'cmake-E-copy-t-mode'
8d9069e5b6 cmake -E copy: Add support for -t argument

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7913
2022-11-15 09:14:07 -05:00
Brad King
3379723239 Merge topic 'test-isolate-ctest-env'
e46a9d79fc Tests: Isolate more RunCMake cases from external ctest environment values
3b6c1c1a3b Tests: Factor out RunCMake ctest environment isolation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7909
2022-11-15 09:11:10 -05:00
Brad King
6f9544736a Merge topic 'better_handling_of_build_args'
01611f8258 cmake: --build improve detection of no build dir

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7908
2022-11-15 08:55:19 -05:00
Brad King
82e49021fe Merge topic 'top-level-command-order'
59573bf5b9 project: Warn at top-level if `cmake_minimum_required` wasn't called
23f3dd9f7c RunCMake/project: Ignore exact line number in stderr checks

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7902
2022-11-15 08:51:20 -05:00
Kyle Edwards
8d9069e5b6 cmake -E copy: Add support for -t argument
Fixes: #23543
2022-11-15 07:47:07 -05:00
Brad King
94164ea55e CMP0141: Fix PCH REUSE_FROM when MSVC_DEBUG_INFORMATION_FORMAT is empty
Under the policy's NEW behavior, `[CMAKE_]MSVC_DEBUG_INFORMATION_FORMAT`
may be explicitly set to an empty string to tell CMake not to add any
flags for this abstraction.  In this case, fall back to checking the
language-wide flags as we do in the OLD behavior.

This revises commit 183b9a9eca (CMP0141: Fix PCH REUSE_FROM under policy
NEW behavior, 2022-10-31, v3.25.0-rc3~4^2).

Issue: #24106
2022-11-15 06:57:02 -05:00
Brad King
e46a9d79fc Tests: Isolate more RunCMake cases from external ctest environment values
Fix a few RunCMake cases that were running `ctest` without isolating it
from external environment values that affect its behavior.

Fixes: #24153
2022-11-14 11:08:45 -05:00