Commit Graph

40 Commits

Author SHA1 Message Date
AJIOB
5de7a09e77 Tests/RunCMake: Match dots more precisely, part 3 2025-10-20 14:45:24 -04:00
AJIOB
62b112ee25 Tests/RunCMake: Match CMakeLists.txt file name more precisely 2025-10-16 17:42:12 +03:00
Hanna Rusakovich
638cf8f194 Tests/RunCMake: Match CMakeLists.txt file name more precisely 2025-10-15 09:39:01 -04:00
Vito Gamberini
d71b59a4f7 install(TARGETS): Don't ignore non-extant file sets
When installing FILE_SETs, it is possible the FILE_SET has not yet been
created with target_sources(FILE_SET). Instead of ignoring this
situation, we need to track the installed FILE_SET names and their
possible install destinations.

At generation time we resolve the names and destinations concretely. If
a FILE_SET wasn't provided or isn't an INTERFACE, we silently bail out.

Fixes: #26697
2025-06-12 16:58:11 -04:00
Brad King
f8bc8780c1 CMP0026: Remove support for OLD behavior 2025-01-19 09:40:59 -05:00
Robert Maynard
0cfd8fe8ad cmTarget: Don't allow setting read-only properties
Ensure that all documented read-only target properties now produce
errors when trying to set.
2024-01-23 08:50:38 -05:00
Ben Boeckel
0c07f39006 cmExperimental: remove the flag for C++ modules
All the major compilers now have scheduled releases with support for
scanning, so remove the experimental gate.

Fixes: #18355
2023-10-02 10:17:31 -04:00
Ben Boeckel
48ee946fdc cmExperimental: recycle the C++ modules API UUID
Supporting modules on IMPORTED targets is worth an update.
2023-08-17 14:42:54 -04:00
Ben Boeckel
be53c75852 cmExperimental: recycle the C++ modules API UUID
`try_compile` and `try_run` now support C++ modules.
2023-07-31 11:59:50 -04:00
Ben Boeckel
57ef353d22 cmExperimental: refresh the C++ modules UUID
The transitive support for Clang is a change in support for the
ecosystem.
2023-07-13 08:40:22 -04:00
Kyle Edwards
70f36de1e5 File set: Allow absolute CMAKE_INSTALL_INCLUDEDIR
When install(TARGETS) and install(EXPORT) were called with file sets
and an absolute CMAKE_INSTALL_INCLUDEDIR, "${_IMPORT_PREFIX}/" was
still being prepended to the base directory and files, resulting in
incorrect paths. Don't prepend this when absolute paths are used.

Fixes: #25010
2023-06-20 11:39:11 -04:00
Ben Boeckel
7b62a83c6f cxxmodules: update the experimental UUID
Syntactic support for C++ header units has been removed, so a new UUID
is warranted.
2023-05-31 10:57:11 -04:00
Ben Boeckel
6ff5cdc533 cxxmodules: remove support for CXX_MODULE_HEADER_UNITS filesets
There's no backing implementation for header units anyways, so just
remove it for now.
2023-05-31 10:57:11 -04:00
Brad King
8c96d145c1 Tests/RunCMake: Match 'Tried extensions' output more robustly 2023-03-09 14:35:05 -05:00
Brad King
b909be9e23 target_sources: Fix backtrace on missing source
If a source file is not found, the error message reports a backtrace.
Previously the backtrace pointed at where the target was created.
In the case of `target_sources`, the missing source may have been
named elsewhere.

Fixes: #24538
2023-02-28 18:07:36 -05:00
Brad King
4a3e79048b Tests: Add RunCMake.target_sources case covering missing source 2023-02-28 17:50:31 -05:00
Ben Boeckel
7e3f9aa1b2 target_sources: give a hint when a file named FILE_SET is not found
`FILE_SET` is only supported within `target_sources()` and only directly
after a visibility keyword or another `FILE_SET`. Give a hint as to what
might be wrong if a file named `FILE_SET` cannot be found for any
reason.

Fixes: #24539
2023-02-24 17:43:22 -05:00
Brad King
1edf138506 Tests/RunCMake: Update cmake_minimum_required versions
For policy-specific tests, use the version before the policy was
introduced.  Otherwise, use 3.5 where possible.

Also, remove `cmake_minimum_required()` and `project()` calls from
individual cases where they are handled by `CMakeLists.txt`.
2023-02-11 06:24:22 -05:00
Ben Boeckel
e84fcbcb0b cxxmodules: support new round of Clang patches
These patches now support the `-MF` output, so remove the `none` support
added just for the old patchset which did not use it.

Also update the flag name to `-fmodule-output=`.

Due to the new Clang module mapper flag, use a new experimental support
UUID as well.
2022-12-15 18:43:47 -05:00
Ben Boeckel
2991e92ea7 cmExperimental: recycle C++20 module support UUID
Visual Studio support warrants a new ID.
2022-12-01 11:42:46 -05:00
Ben Boeckel
48502a3781 cmExperimental: update CXX_MODULE_CMAKE_API UUID
The set of features available has been expanded, so update the UUID.
2022-07-06 10:15:23 -04:00
Brad King
5a460f3243 Merge topic 'file-set-crash'
3fee5398bd install(EXPORT): Check for missing file sets at generate time

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7420
2022-06-30 08:20:24 -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
Ben Boeckel
386465bf83 cmTarget: add support for C++ module fileset types
C++ modules have two variants which are of importance to CMake:

  - `CXX_MODULES`: interface modules (those using `export module M;`,
    `export module M:part;`, or `module M:internal_part;`)
  - `CXX_MODULE_HEADER_UNITS`: importable header units

Creating C++ modules or partitions are *not* supported in any other
source listing. This is because the source files must be installed (so
their scope matters), but not part of usage requirements (what it means
for a module source to be injected into a consumer is not clear at this
moment). Due to the way `FILE_SET` works with scopes, they are a perfect
fit as long as `INTERFACE` is not allowed (which it is not).
2022-06-16 10:28:34 -04:00
Ben Boeckel
9916d4dd44 cmTarget: factor out fileset type handling
This allows for new fileset types to be added more easily by factoring
out the declarative information into a structure.
2022-04-25 16:49:57 -04:00
Ben Boeckel
79d6b928a3 RunCMake/target_sources: test HEADERS file sets via generic props 2022-04-25 14:29:17 -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
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
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
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
Kyle Edwards
8c23ecbd93 target_sources(): Process multiple FILE_SET arguments per block
Fixes: #23287
2022-03-03 14:31:54 -05:00
Kyle Edwards
b357d334fc target_sources(): Enforce stricter requirements for FILE_SET name
Fixes: #23286
2022-03-03 10:17:10 -05:00
Kyle Edwards
ad41c9cd11 target_sources(): Prohibit FILE_SET on custom targets
Fixes: #23262
2022-02-28 17:21:04 -05:00
Kyle Edwards
058b8a0bfb install(): Properly ignore FILE_SETs that don't exist
Fixes: #22960
2022-02-17 14:43:06 -05:00
Kyle Edwards
a7c71b9f03 Tests: Add tests for target_sources(FILE_SET) and associated functionality 2021-10-27 15:17:23 -04:00
Kyle Edwards
7d07569e4d Tests/RunCMake: Merge TargetSources into target_sources 2021-10-19 16:59:10 -04:00
Ben Boeckel
4babc9058a cmTargetPropCommandBase: check keywords after parsing
The following was disallowed:

   add_library(iface INTERFACE)
   target_link_libraries(iface PUBLIC)

just due to the mention of the `PUBLIC` keyword. Instead, only error if
there are actually `PUBLIC` dependencies specified (and analogously for
other restrictions).

Update tests to expect this new behavior.
2018-10-26 12:09:41 -04:00
Ben Boeckel
4201a11c2b Tests: add tests for empty-value keyword arguments in target_*
Not all of these commands accept non-compilable (i.e., IMPORTED)
targets, so those calls are currently just commented out. If they ever
do start to accept them, the tests should be enabled.
2018-10-26 12:08:05 -04:00