Commit Graph

34 Commits

Author SHA1 Message Date
Raul Tambre
359c500a24 cmTarget: Raise error if imported target location is not set
Previously we would synthesize <TARGET_NAME>-NOTFOUND as the location. This
would then end up on the link line and cause build failures.
Policy CMP0110 is added to control this behaviour.

Fixes #19080, #19943.
2020-08-21 08:38:39 -04:00
Brad King
bafa9fe887 fileapi: Add INTERFACE libraries with SOURCES to codemodel-v2
INTERFACE libraries with SOURCES now appear in the generated
buildsystem, so include them in the codemodel output too.

We do not need to bump the `codemodel-v2` object kind minor
version because that was already done in post-3.18 development
by commit 7d6861f367 (fileapi: Extend codemodel targets with
language standard, 2020-06-18).

Fixes: #18608
2020-08-07 08:46:34 -04:00
Justin Goshi
2f383d852d fileapi: Support multiple backtraces for language standard 2020-07-06 11:40:39 -07:00
Justin Goshi
7d6861f367 fileapi: Extend codemodel targets with language standard 2020-06-26 08:52:29 -04:00
Justin Goshi
9f6d40ee23 fileapi: Extend codemodel targets with PRECOMPILE_HEADERS 2020-05-22 11:26:55 -04:00
Justin Goshi
b698764a31 Tests: Add a PCH example to RunCMake.FileAPI codemodel-v2 2020-05-22 11:23:33 -04:00
Brad King
b3812c0e54 Tests: Fix indentation in RunCMake.FileAPI cxx_exe.json 2020-05-22 10:07:30 -04:00
Brad King
a833aa1167 Fix dependencies on targets linked through object libraries
When an object library is used via `target_link_libraries`, any targets
listed in the object library's `INTERFACE_LINK_LIBRARIES` closure should
become direct dependencies of the consuming target.  However, these were
accidentally left out by `cmComputeTargetDepends::CollectTargetDepends`
because object libraries are encountered through external object sources
first and then added to the `emitted` set which blocks them from being
processed as link dependencies.

This was not noticed by the test case in commit bab24e782c
(target_link_libraries: Propagate dependencies of object libraries,
2018-12-10, v3.14.0-rc1~260^2) because the relevant dependency appears
transitively through the object library target itself.

Re-order the logic to process link dependencies first, and then external
object sources.  That way object libraries used via
`target_link_libraries` will be treated as such by dependency analysis.

This also adds missing backtrace information for object libraries used
via `target_link_libraries`.  The missing information was mentioned in a
FIXME comment in the RunCMake.FileAPI test added by commit ea0a060168
(fileapi: Add test for codemodel v2, 2018-11-09, v3.14.0-rc1~257^2~7).
That comment itself was dropped by commit a0de350e2f (FileAPI test:
Break gen_check_targets() into JSON files, 2020-02-07), but we can now
update the corresponding location in the `.json` files to have the
now-expected backtrace information.

Fixes: #20421
2020-03-04 13:07:41 -05:00
Kyle Edwards
75e71263e7 FileAPI test: Break gen_check_projects() into JSON files 2020-02-07 13:42:20 -05:00
Kyle Edwards
a0de350e2f FileAPI test: Break gen_check_targets() into JSON files 2020-02-07 13:37:15 -05:00
Kyle Edwards
de8ebc9dba FileAPI test: Break gen_check_directories() into JSON files 2020-02-07 11:17:23 -05:00
Kyle Edwards
1605fcbbd9 FileAPI test: Add infrastructure for reading JSON test data 2020-02-07 10:58:10 -05:00
Kyle Edwards
9e219de4fb Ninja Multi-Config: Don't include MinSizeRel by default 2020-02-06 11:07:38 -05:00
Kyle Edwards
5a8a9f7229 Ninja: Add multi-config variant
Co-Authored-by: vector-of-bool <vectorofbool@gmail.com>
2019-12-13 10:51:46 -05:00
Kyle Edwards
51c69fe5f8 FileAPI: Add "multiConfig" parameter to index file 2019-11-20 09:46:10 -05:00
Justin Goshi
8b84c046fa fileapi: add some source property backtraces
Support backtraces for COMPILE_DEFINITIONS, COMPILE_OPTIONS, and
INCLUDE_DIRECTORIES source properties.
2019-09-26 10:56:52 -04:00
Justin Goshi
4d6334824d fileapi: add backtraces for LINK_PATH and LINK_DIRECTORIES 2019-09-18 14:00:39 -04:00
Justin Goshi
30006e199b fileapi: add backtraces for compile/link options 2019-09-10 10:45:41 -04:00
Brad King
7eb2fd6ca6 Merge topic 'fileapi-install-generators'
d70a0f8681 fileapi: Fix codemodel target install destination for cross-dir rules

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3639
2019-08-05 10:20:27 -04:00
Brad King
d70a0f8681 fileapi: Fix codemodel target install destination for cross-dir rules
Since commit e89ad0f94e (install: Allow installing targets created in
another directory, 2018-06-18, v3.13.0-rc1~407^2) we support calling
`install(TARGETS)` for targets created in another directory.  However,
install generators are associated with the directory in which the call
to `install()` appears.  This may not be the same directory in which the
target is defined.  Record in each target the list of install generators
it has.

Fixes: #19546
2019-07-31 19:32:55 -04:00
Brad King
2fa920c0cd AIX: Create import library for executables with exports
On AIX, plugins meant to be loaded into executables via `dlopen` must be
linked with access to a list of symbols exported from the executable in
order to use them (when not using runtime linking).  The AIX linker
supports specifying this list as an "import file" passed on the command
line either via the `-bI:...` option or (with a leading `#! .` line) as
a normal input file like any other library file.

The linker import file plays the same role on AIX as import libraries do
on Windows.  Teach CMake to enable its import library abstraction on AIX
for executables with the `ENABLE_EXPORTS` target property set.  Teach
our internal `ExportImportList` script to optionally generate a leading
`#! .` line at the top of the generated export/import list.  Update our
rule for linking an executable with exports to generate a public-facing
"import library" implemented as an AIX linker import file.

With this approach, our existing infrastructure for handling import
libraries on Windows will now work for AIX linker import files too:

* Plugins that link to their executable's symbols will be automatically
  linked using the import file on the command line.

* The executable's import file will be (optionally) installed and
  exported for use in linking externally-built plugins.

This will allow executables and their plugins to build even if we later
turn off runtime linking.

Issue: #19163
2019-07-16 14:15:13 -04:00
Brad King
4b6b2a571c fileapi: extend codemodel v2 with directory details
Issue: #18398
Co-Author: Kyle Edwards <kyle.edwards@kitware.com>
2018-12-12 15:12:26 -05:00
Brad King
eb8c7676a4 fileapi: extend codemodel v2 with a project model
Offer clients a `project()`-centric view of the build system.  This is
similar to the directory-centric view but consolidates subdirectories
that do not call `project()` with a new project name.

Issue: #18398
Co-Author: Kyle Edwards <kyle.edwards@kitware.com>
2018-12-12 15:12:26 -05:00
Kyle Edwards
42f0125ceb fileapi: Add test for cmakeFiles v1 2018-12-12 13:02:31 -05:00
Brad King
6615408193 fileapi: add cmakeFiles v1
Issue: #18398
2018-12-12 09:46:13 -05:00
Kyle Edwards
3f6ee75a66 fileapi: Add test for cache v2 2018-12-12 09:46:13 -05:00
Brad King
7489e95b8e fileapi: add cache v2
Start with v2 to distinguish it from server-mode v1.

Issue: #18398
2018-12-12 09:46:13 -05:00
Kyle Edwards
ea0a060168 fileapi: Add test for codemodel v2 2018-12-12 09:45:49 -05:00
Brad King
3e922ceb5e fileapi: add codemodel v2
Start with v2 to distinguish it from server-mode v1.

Issue: #18398
2018-12-12 06:40:10 -05:00
Kyle Edwards
555fa77a35 fileapi: Add more infrastructure to FileAPI test 2018-12-12 06:40:10 -05:00
Brad King
b83fe27d8d fileapi: Report cmake generator in reply index file 2018-12-12 06:40:10 -05:00
Brad King
276fdf2993 fileapi: Add protocol v1 support for stateful per-client queries
Add support for client-owned *stateful* query files.  These allow
clients to request a list of versions of each object kind and get only
the first-listed version that CMake recognizes.  Since clients own their
stateful query files they can mutate them over time.  As a client
installation is updated it may update the queries that it writes to
build trees to get newer object versions without paying the cost of
continuing to generate older versions.

Issue: #18398
2018-12-12 06:40:10 -05:00
Brad King
8fce59848b fileapi: Add protocol v1 support for client-specific query files
Add support for client-owned stateless query files.  These allow clients
to *own* requests for major object versions and get all those recognized
by CMake.

Issue: #18398
2018-12-12 06:40:10 -05:00
Brad King
eb2ec41a04 fileapi: Add protocol v1 infrastructure with support for shared query files
Add a file-based API that clients may use to get semantic information
about the buildsystem that CMake generates.  Clients will write query
files under a designated location in the build tree, and CMake will
write reply files for clients to read.

Start with support for shared stateless query files.  These allow
clients to share requests for major object versions and get all those
recognized by CMake.  Once any client has written a shared request to a
build tree it will persist.  Other clients will not need to overwrite
the request (since it is stateless) and should not remove it either.

For now we add only an undocumented object kind to use for testing the
query and reply infrastructure.  Object kinds providing real semantic
information will be added later.

Issue: #18398
2018-12-12 06:39:30 -05:00