1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-05-12 08:05:28 +08:00

129 Commits

Author SHA1 Message Date
Ben Boeckel
142a85f9c1 cxxmodules: use filesystem-safe export names in filenames
Also add tests.

Fixes: #25828
2024-04-30 09:05:16 -04:00
Ben Boeckel
d791f3a180 cxxmodules: make export trampoline script files unique
Include the name of the `EXPORT` in the filename when generating export
information for C++ modules. This allows the same directory to be used
for multiple sets of C++ module-using targets.

For `export(TARGETS)` uses, generate a name based on the hash of the
concatenation of the target names involved with the `export()` call.

Fixes: #25609
2024-01-18 17:40:44 -05:00
Ben Boeckel
0f36156740 cxxmodules: include INCLUDES DESTINATION directories
These paths are added outside the normal property management mechanisms.
Shuttle the value to the C++ module export as needed.

Fixes: #25289
2023-10-16 13:57:54 -04:00
Ben Boeckel
249cd3efad cmExportFileGenerator: export private compile info for C++ modules
When consuming exported targets which contain C++ modules, the consuming
project must be able to recompile BMI files using the original target's
flags. This is because a module source may use some private target usage
requirement but not want to propagate it to consumers. To facilitate
this, export the private information as necessary for consumers to be
able to perform the BMI compilations.
2023-08-17 14:42:53 -04:00
Ben Boeckel
d4144b9c0a strings: use emplace_back with cmStrCat arguments 2023-07-27 20:15:51 -04:00
Marc Chevrier
45f17e5a85 cmList: Add container conversion to string 2023-06-22 15:44:17 +02: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
Tyler
f2a699261b cxxmodules: Do not expect collator install scripts with no CXX_MODULES
Calling `install(EXPORT)` with the `CXX_MODULES_DIRECTORY` parameter
leads to installation rules being generated which `include()` CMake
scripts that set the `IMPORTED_CXX_MODULES_[CONFIG]` target property for
relevant targets.  However, these scripts don't get generated for
targets in an export set which don't have any C++20 modules.  When the
installation rules attempt to `include()` the missing scripts, the
install fails.

Co-authored-by: Brad King <brad.king@kitware.com>
2023-05-23 15:01:32 -04:00
Orkun Tokdemir
c5c3aff1f5
Autogen: Add INTERFACE_AUTOMOC_MACRO_NAMES target property
Add this target property to specify macro names that propagate to
dependents as `AUTOMOC_MACRO_NAMES`.  The dependents will automatically
generate MOC files for source files that contain the inherited macro
names.

Co-Authored-By: Craig Scott <craig.scott@crascit.com>
Fixes: #19679
2023-04-09 20:51:15 +10:00
Marc Chevrier
ede33f30cf Apple: Handle generation and comsuption of text-based stubs (.tbd files)
Fixes: #24123
2023-03-01 12:23:28 +01:00
Ben Boeckel
3526b8c123 cmExport*FileGenerator: support exporting C++ module properties
C++ module properties will be generated at build time, so generate code
that includes the files actually responsible for the information.
2022-07-06 10:15:23 -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
Brad King
49c96c6508 Merge topic 'file-set-build-export'
9ee47188c0 cmExportBuildFileGenerator: handle genex-wrapped source paths
60fab8a6e0 cmInstallCommand: tweak error message

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7182
2022-04-21 11:49:40 -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
Brad King
dd193fa3d3 Merge topic 'export-missing-targets'
8c65b7042e cmExportFileGenerator: Simplify collection of targets missing from export set

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7165
2022-04-14 09:34:59 -04:00
Hyper Nova Sun
41ba35a42b cmTarget: Add HasKnownObjectFileLocation() shorthand
Allow `cmGlobalGenerator`s to decide `HasKnownObjectFileLocation()` per given
`cmTarget`

- `cmGlobalGenerator::HasKnownObjectFileLocation()` now takes an optional `cmGeneratorTarget`
- `cmTarget::HasKnownObjectFileLocation()` added as a shorthand
2022-04-11 14:10:29 -07:00
Brad King
8c65b7042e cmExportFileGenerator: Simplify collection of targets missing from export set
Store the list of missing target names in a member instead of threading
an explicit reference to it through the call stack.
2022-04-11 13:40:13 -04:00
Kyle Edwards
2a78d47b16 install(EXPORT): Install file sets 2021-10-27 15:17:23 -04:00
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Marc Chevrier
e5cd39ca80 cmProp: refactoring: transform alias in class
To handle safely the values used by CMake variables and properties,
introduce the class cmProp as a replacement from the simple pointer
to std::string instance.
2021-08-08 16:19:08 +02:00
Eugene Shalygin
e8e19ed8f2 Refactor export file generator inteface
Replace cmTargetExport with const cmGeneratorTarget to allow recursive
processing of exported targets and their link dependencies.
2021-07-22 13:08:58 +02:00
Deniz Bahadir
38bcb5c0a3 export: Do not fail generation for separate namelink only case
Update the change from commit 64690f6df0 (export: Do not fail generation
for namelink-only case, 2020-10-09, v3.19.0-rc1~7^2) to also handle
separate namelink-only and namelink-skip calls.

Fixes: #21529
2020-12-01 07:35:17 -05:00
Marc Chevrier
aacd4e4a90 Refactoring: add cm::contains to <cmext/algorithm> 2020-04-17 10:00:03 +02:00
Marc Chevrier
5444a8095d cmGlobalGenerator: modernize memrory managemenbt 2019-12-30 16:55:39 +01:00
Marc Chevrier
f7d12609f0 Refactoring: use append functions from cmext/algorithm 2019-12-17 10:44:02 +01:00
Kitware Robot
ed98209ddc Revise include order using clang-format-6.0
Run the `clang-format.bash` script to update our C and C++ code to a new
include order `.clang-format`.  Use `clang-format` version 6.0.
2019-10-01 12:26:36 -04:00
Tushar Maheshwari
71f088f53a cmExportSet: subsume cmExportSetMap source files 2019-09-19 19:20:30 +05:30
Tushar Maheshwari
6511fa6f33 cmExportSet: default destructor 2019-09-19 19:20:29 +05:30
Regina Pfeifer
d63c1e4e6e clang-tidy: modernize-return-braced-init-list 2019-09-06 22:27:39 +02:00
Daniel Pfeifer
0467a2f91b PCH: add PRECOMPILE_HEADERS to special properties 2019-08-26 18:16:42 +02:00
Sebastian Holtermann
9b334397f5 Source sweep: Use cmStrCat for string concatenation
This patch is generated by a python script that uses regular expressions to
search for string concatenation patterns of the kind

```
std::string str = <ARG0>;
str += <ARG1>;
str += <ARG2>;
...
```

and replaces them with a single `cmStrCat` call

```
std::string str = cmStrCat(<ARG0>, <ARG1>, <ARG2>, ...);
```

If any `<ARGX>` is itself a concatenated string of the kind

```
a + b + c + ...;
```

then `<ARGX>` is split into multiple arguments for the `cmStrCat` call.

If there's a sequence of literals in the `<ARGX>`, then all literals in the
sequence are concatenated and merged into a single literal argument for
the `cmStrCat` call.

Single character strings are converted to single char arguments for
the `cmStrCat` call.

`std::to_string(...)` wrappings are removed from `cmStrCat` arguments,
because it supports numeric types as well as string types.

`arg.substr(x)` arguments to `cmStrCat` are replaced with
`cm::string_view(arg).substr(x)`
2019-08-22 16:38:10 +02:00
Regina Pfeifer
2dfc52675c cmAlgorithms: Add cmContains
Also, use the new function where applicable.
2019-08-19 20:01:39 +02:00
Sebastian Holtermann
f71f7ce3f0 cmStringAlgorithms: Move string functions to the new cmStringAlgorithms.h
This adds the `cmStringAlgorithms.h` header and moves all string functions
from `cmAlgorithms.h` to `cmStringAlgorithms.h`.
2019-07-29 21:13:56 +02:00
Brad King
22d3eb5d5e Refactor checks for whether a target has an import library
Use `HasImportLibrary` for such checks.
2019-07-12 17:29:40 -04:00
Ben Boeckel
49cfd39007 cmExportBuildFileGenerator: improve error message
When an exported target depends on another exported target that is
included in multiple build export sets, the error message was woefully
unhelpful. Now, include information about what build exports the
dependent target was included in with instructions for fixing the
problem that are actually helpful.
2019-06-27 10:57:34 -04:00
Robert Maynard
5d8f1a8421 Export: A singular CMake version written for interface targets 2019-06-17 17:38:46 -04:00
Bruno Manganelli
cc2a5261f8 Factor out enum MessageType into dedicated header
Reduce the number of files relying on `cmake.h`.
2019-01-16 08:16:31 -05:00
Marc Chevrier
a71caab46b LINK_DIRECTORIES: Add new properties and commands
These new capabilities enable to manage link directories

Two new properties:
* target properties: LINK_DIRECTORIES and INTERFACE_LINK_DIRECTORIES

One new command
* target_link_directories(): to populate target properties

Fixes: #17215
2018-09-25 23:59:58 +10:00
Marc Chevrier
cc9f88af53 LINK_DEPENDS: add support for property INTERFACE_LINK_DEPENDS
Fixes: #17997
2018-06-27 18:38:36 +02:00
Marc Chevrier
c1f5a44b28 LINK_OPTIONS: Add new family of properties
This family enable to manage link flags

Three new properties:
* directory property: LINK_OPTIONS
* target properties: LINK_OPTIONS and INTERFACE_LINK_OPTIONS

Two new commands
* add_link_options(): to populate directory property
* target_link_options(): to populate target properties

Fixes: #16543
2018-06-06 17:22:39 +02:00
luz.paz
be28106880 Fix misc. typos
Found via `codespell` and `grep`
2018-06-04 10:32:49 -04:00
Michael Stürmer
fb433ff283 cmGeneratorTarget: Make import library checks config-aware 2018-04-05 06:36:49 +02:00
Wouter Klouwen
6db61f0725 Export: allow exporting of additional properties
This change introduces an additional property that may be set on a
target to allow additional properties to be exported. Normally only a
limited number of properties are exported.

Additional properties may be exported by simply setting the
`EXPORT_PROPERTIES` property on a target that is exported.
2018-03-16 09:00:56 -04:00
Deniz Bahadir
dfb6e84082 objlib: Allow other libraries to link to OBJECT libraries.
Note: This only allows `OBJECT` libraries to be on the right-hand side
of `target_link_libraries` but still does not link its object-files to
the target on the left-hand side.

Issue: #14778
2018-03-01 09:24:24 -05:00
Brad King
ea0ce73a19 install,export: Maybe transform OBJECT libraries to INTERFACE libraries
Teach the `install` and `export` commands to support installing and
exporting `OBJECT` libraries without their object files.  Transform
them to `INTERFACE` libraries in such cases.

For `install(TARGETS)`, activate this when no destination for the object
files is specified.  For `export`, activate this only under Xcode with
multiple architectures when we have no well-defined object file
locations to give to clients.
2018-02-28 10:58:10 -05:00
Pavel Solodovnikov
c85bb007df Reduce allocation of temporary values on heap.
- Use `std::move` while inserting temporary results into vectors.
- Change `push_back` to `emplace_back` where appropriate.
2018-01-26 13:24:45 +03:00
Pavel Solodovnikov
7d5095796a Meta: modernize old-fashioned loops to range-based for.
Changes done via `clang-tidy` with some manual fine-tuning
for the variable naming and `auto` type deduction
where appropriate.
2017-09-12 16:22:47 +03:00
Daniel Pfeifer
190e3825d4 Replace C-style casts 2017-08-27 09:58:46 +02:00
Daniel Pfeifer
5962db4389 Use C++11 nullptr 2017-08-24 23:39:47 +02:00
Gregor Jasny
cf320f7cd7 Replace boolean implib parameters with enum
Named enumeration values are much clearer at call sites and add more
type safety.
2017-04-20 10:22:33 -04:00