summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.h
Commit message (Collapse)AuthorAgeFilesLines
* cmTarget: add support for C++ module fileset typesBen Boeckel2022-06-161-0/+30
| | | | | | | | | | | | | | | 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).
* clang-tidy: address `modernize-use-default-member-init` lintsBen Boeckel2022-05-241-14/+14
|
* export: Fix TARGET_NAME lookup for out-of-dir linkingBrad King2022-04-011-3/+3
| | | | | | | Improve the logic added by commit f0e67da061 (target_link_libraries: Fix out-of-dir linking of a list of targets, 2020-01-14, v3.17.0-rc1~149^2) to, while exporting targets, look up referenced target names in the correct directory.
* FILE_SET: Add VERIFY_HEADER_SETS target propertyKyle Edwards2022-03-291-0/+5
| | | | Fixes: #23338
* LINK_LIBRARIES: Evaluate separately for linking and usage requirementsBrad King2022-03-221-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | We evaluate `LINK_LIBRARIES` and `INTERFACE_LINK_LIBRARIES` for two purposes: * Constructing the link line. * Collecting usage requirements. We evaluate `INTERFACE_LINK_LIBRARIES` separately for each purpose in order to support the `$<LINK_ONLY:...>` generator expression used to express private link dependencies of a static library. Previously we only evaluated `LINK_LIBRARIES` for linking, and used that result for collecting usage requirements too. Therefore `$<LINK_ONLY:...>` does not work in `LINK_LIBRARIES`. With the introduction of `INTERFACE_LINK_LIBRARIES_DIRECT`, evaluation of `LINK_LIBRARIES` now needs to distinguish these two cases in order to honor link dependencies encountered through `$<LINK_ONLY:...>` without also exposing other usage requirements through private dependencies of a static library. Revise internal infrastructure to distinguish the two cases when evaluating `LINK_LIBRARIES`. Make the information available in code paths for `INTERFACE_LINK_LIBRARIES_DIRECT` and `LINK_ONLY`. Defer actually using the information to later commits. Issue: #22496
* Genex: Add $<LINK_LIBRARY:...>Marc Chevrier2022-02-071-1/+2
| | | | | | | | This generator expression offers the capability, for the link step, to decorate libraries with prefix/suffix flags and/or adding any specific flag for each library. Fixes: #22812, #18751, #20078, #22703
* Merge topic 'link-interface-direct'Brad King2022-01-311-3/+20
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | f3ad061858 Add usage requirements to update direct link dependencies 193a999cd5 cmTarget: Add INTERFACE_LINK_LIBRARIES_DIRECT{,_EXCLUDE} backtrace storage 22d5427aa6 cmGeneratorTarget: Add LookupLinkItem option to consider own target name f3d2eab36a cmGeneratorTarget: Fix link interface caching of partial results d75ab9d066 cmGeneratorTarget: Clarify CMP0022 logic in ComputeLinkInterfaceLibraries f3e9e03fe0 cmGeneratorTarget: Simplify CMP0022 warning check 216aa14997 cmGeneratorTarget: Return early from ExpandLinkItems with no items 1bc98371d1 Tests: Remove unnecessary policy setting from ObjectLibrary test ... Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6886
| * Add usage requirements to update direct link dependenciesBrad King2022-01-291-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Link line construction starts with `LINK_LIBRARIES` and appends dependencies from the transitive closure of `INTERFACE_LINK_LIBRARIES`. Only the entries of `LINK_LIBRARIES` are considered direct link dependencies. In some advanced use cases, particularly involving static libraries and static plugins, usage requirements need to update the list of direct link dependencies. This may mean adding new items, removing existing items, or both. Add target properties to encode these usage requirements: * INTERFACE_LINK_LIBRARIES_DIRECT * INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE Fixes: #22496
| * cmGeneratorTarget: Add LookupLinkItem option to consider own target nameBrad King2022-01-291-1/+7
| |
| * PCH: Clear link interface cache when adding PCH object to itBrad King2022-01-291-0/+3
| | | | | | | | | | | | | | On platforms using `CMAKE_LINK_PCH`, the implementation of `PRECOMPILE_HEADERS_REUSE_FROM`, when re-using the PCH from one object library in another, adds a PCH object file to the link interface. Clear any cached link interface to ensure it is used.
* | cmGlobalVisualStudio10Generator: Auto restore NuGet packages.Carsten Rudolph2022-01-221-0/+3
|/
* Merge topic 'vs-csharp-dotnet-sdk'Brad King2021-12-221-0/+2
|\ | | | | | | | | | | | | | | | | 0eea32a376 VS: Add DOTNET_SDK property to generate SDK-style C# projects a450cc9533 VS: Set ResolveNugetPackages to false for ALL_BUILD and ZERO_CHECK fa76e5d194 cmVisualStudio10TargetGenerator: Factor out helper for classic MSBuild project Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6634
| * VS: Add DOTNET_SDK property to generate SDK-style C# projectsSumit Bhardwaj2021-12-211-0/+2
| | | | | | | | | | | | | | | | Changes in cmVisualStudio10TargetGenerator::Generate to write .Net SDK-style project for VS generators VS 19 and above. Also adds documentation and tests. Issue: #20227
* | target_link_libraries: Optionally require only target namesBrad King2021-12-201-0/+1
| | | | | | | | | | | | | | | | | | | | Optionally verify that items in `LINK_LIBRARIES` and `INTERFACE_LINK_LIBRARIES` that can be target names are actually target names. Add a `LINK_LIBRARIES_ONLY_TARGETS` target property and corresponding `CMAKE_LINK_LIBRARIES_ONLY_TARGETS` variable to enable this new check. Fixes: #22858
* | CMP0028: Report the target whose link interface has an offending itemBrad King2021-12-161-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | Previously items linked via the link interface of a dependency were reported in CMP0028 messages as if directly linked by a target. Clarify the messages to indicate that an offending item is actually in the link interface of a given target, regardless of its consumer. Move the check to the end of generation and look through the final set of link implementations and link interfaces that were used for generation. This avoids repeating messages on link interfaces that have multiple consumers.
* | cmGeneratorTarget: Propagate backtraces from INTERFACE_LINK_LIBRARIESBrad King2021-12-151-2/+3
|/
* cmGeneratorTarget: Avoid boolean trap in usage requirement lookupBrad King2021-12-091-6/+12
| | | | | Replace `bool usage_requirements_only` arguments with a proper enumeration to clarify meaning at call sites.
* Source: Fix clang -Wextra-semi warningsSean McBride2021-09-281-1/+1
|
* Rename cmProp in cmValueMarc Chevrier2021-09-211-17/+17
|
* macOS: Speed up rpath install name dir lookup with a cacheLukas Böger2021-09-201-0/+5
| | | | Fixes: #20602
* Refactor: Convert parallel string/backtrace vectors to BT vectorsKyle Edwards2021-09-031-4/+2
|
* Refactor: reduce cmToCStr usageMarc Chevrier2021-08-191-2/+1
|
* Refactor: cmGeneratorTarget::GetSourcesProperty returns cmPropMarc Chevrier2021-08-091-1/+1
|
* cmGeneratorTarget: Simplify ExpandLinkItems signatureBrad King2021-07-131-5/+2
|
* cmGeneratorTarget: Add method for LINKER: prefix translationMarc Chevrier2021-07-081-0/+3
|
* Merge topic 'tll-out-of-dir'Brad King2021-06-301-1/+6
|\ | | | | | | | | | | | | e27a76f131 target_link_libraries: Restore transitive out-of-dir linking Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6285
| * target_link_libraries: Restore transitive out-of-dir linkingBrad King2021-06-291-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | Refactoring in commit 7f506b95a7 (cmGeneratorTarget: Refactor link item lookup, 2021-05-26, v3.21.0-rc1~103^2~4) accidentally dropped the persistent lookup scope tracking across multiple items that was added by commit f0e67da061 (target_link_libraries: Fix out-of-dir linking of a list of targets, 2020-01-14, v3.17.0-rc1~149^2). This broke a transitive out-of-dir linking case not covered by our test suite. Restore the scope tracking and add a test case. Fixes: #22363
* | Makefiles: Add support for building Fortran intrinsicsIsuru Fernando2021-06-241-0/+1
|/ | | | Fixes: #21463
* HIP: Automatically inject the `hip::device` runtime targetRobert Maynard2021-06-071-0/+6
| | | | | Any target that might need to link to hip code needs the `hip::device` target
* HIP: Add language to CMakeRobert Maynard2021-06-071-0/+2
|
* target_link_libraries: Place $<TARGET_OBJECTS> before librariesBrad King2021-05-291-0/+1
| | | | | | | | | Linkers always use object files explicitly specified on the command line regardless of where they appear. Move them to the front of the list of linked libraries in so that symbols required by the object files can be resolved by any library. Issue: #22149
* cmGeneratorTarget: Refactor link item lookupBrad King2021-05-281-3/+2
| | | | | Look up items individually so the call sites can do something with the result besides appending to a vector.
* Genex: Add TARGET_RUNTIME_DLLS genexKyle Edwards2021-02-241-0/+5
| | | | Co-Authored-by: Brad King <brad.king@kitware.com>
* Code style: add missed explicit 'this->'Oleksandr Koval2021-01-051-1/+2
| | | | | CMake uses explicit 'this->' style. Using custom clang-tidy check we can detect and fix places where 'this->' was missed.
* cmGeneratorTarget: Make GetConfigCommonSourceFiles Xcode-specificBrad King2020-12-161-2/+3
| | | | | | The Xcode generator is the only place left that we do not support per-config sources. Make the corresponding helper Xcode-specific to avoid any other new uses.
* Compile with explicit language flag when source LANGUAGE property is setBrad King2020-12-021-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | This change was originally made by commit 74b1c9fc8e (Explicitly specify language flag when source LANGUAGE property is set, 2020-06-01, v3.19.0-rc1~722^2), but it was reverted by commit 30aa715fac (Revert "specify language flag when source LANGUAGE property is set", 2020-11-19) to restore compatibility with pre-3.19 behavior. Implement the change again, but add policy CMP0119 to make this change while preserving compatibility with existing projects. Note that the `Compiler/{Clang,Intel,MSVC}-CXX` modules do not need to specify `-TP` for their MSVC-like variants because we already use the flag in `CMAKE_CXX_COMPILE_OBJECT`. Similarly for `Compiler/XL-CXX` and `Platform/Windows-Embarcadero`. Note also that this does not seem possible to implement for XL C. Even with `-qsourcetype=c`, `xlc` complains about an unknown suffix: `1501-218 (W) file /.../AltExtC.zzz contains an incorrect file suffix`. It returns non-zero even with `-qsuppress=1501-218`. Co-Author: Robert Maynard <robert.maynard@kitware.com> Fixes: #14516, #20716
* Merge topic 'cuda_vs_skip_computation'Brad King2020-10-271-0/+2
|\ | | | | | | | | | | | | dd77dec18d VS: Don't compute CUDA options unless necessary Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5422
| * VS: Don't compute CUDA options unless necessaryRaul Tambre2020-10-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the following scenario (with 3.18 policies): 1. A CXX target is created. 2. CUDA language is enabled. CMake 3.18 introduced CMP0104, which requires CUDA_ARCHITECTURES to be set. Because the CXX target was created before CUDA was enabled it wouldn't have it set. The Visual Studio generator would however end up computing CUDA compile options for the CXX target, which would result in a fatal error due to the policy violation. There doesn't seem to be a reason to do this for targets that don't actually use the CUDA language, so we can skip and generate the CXX target just fine. Fixes: #21341
* | Merge topic 'refactor-cmprop'Brad King2020-09-291-6/+6
|\ \ | | | | | | | | | | | | | | | | | | c88dde2869 cmGeneratorTarget: internal refactoring Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5289
| * | cmGeneratorTarget: internal refactoringvvs314152020-09-281-6/+6
| | |
* | | cmGeneratorTarget: Include Cache now occurs per language+configRobert Maynard2020-09-251-0/+2
|/ / | | | | | | | | Previously only occurred per config which broke per-language system includes.
* | OBJECT libraries: Properly recognize if sources depend on configurationDeniz Bahadir2020-09-231-1/+11
| | | | | | | | Fixes: #21198
* | cmGeneratorTarget: Better name for internal variableDeniz Bahadir2020-09-221-1/+1
| |
* | Merge topic 'ispc_improvements'Brad King2020-09-081-0/+9
|\ \ | | | | | | | | | | | | | | | | | | | | | a020787a9b ISPC: Support generation for multiple instruction sets 5a1750017e ISPC: Add compiler launcher support Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5173
| * | ISPC: Support generation for multiple instruction setsRobert Maynard2020-09-041-0/+9
| | |
* | | Modernize: Use #pragma once in all header filesKitware Robot2020-09-031-4/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #pragma once is a widely supported compiler pragma, even though it is not part of the C++ standard. Many of the issues keeping #pragma once from being standardized (distributed filesystems, build farms, hard links, etc.) do not apply to CMake - it is easy to build CMake on a single machine. CMake also does not install any header files which can be consumed by other projects (though cmCPluginAPI.h has been deliberately omitted from this conversion in case anyone is still using it.) Finally, #pragma once has been required to build CMake since at least August 2017 (7f29bbe6 enabled server mode unconditionally, which had been using #pragma once since September 2016 (b13d3e0d)). The fact that we now require C++11 filters out old compilers, and it is unlikely that there is a compiler which supports C++11 but does not support #pragma once.
* | Merge topic 'ispc_lang_support'Brad King2020-09-011-0/+8
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5ece12b7e4 gitlab-ci: add ISPC to the Fedora CI image 8976817d6d ISPC: Update help documentation to include ISPC 2368f46ba4 ISPC: Support building with the MSVC toolchain e783bf8aa6 ISPC: Support ISPC header generation byproducts and parallel builds 34cc6acc81 Add ISPC compiler support to CMake 419d70d490 Refactor some swift only logic to be re-used by other languages Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5065
| * | ISPC: Support ISPC header generation byproducts and parallel buildsRobert Maynard2020-08-281-0/+8
| | |
* | | WIN32_EXECUTABLE: Add support for generator expressionsKyle Edwards2020-08-211-0/+3
| | |
* | | Add option to optimize link dependencies for static librariesKyle Edwards2020-08-121-0/+6
|/ / | | | | | | | | | | | | | | | | Add an `OPTIMIZE_DEPENDENCIES` target property and supporting `CMAKE_OPTIMIZE_DEPENDENCIES` variable to optionally enable pruning and flattening of outgoing dependencies from static libraries. Since they do not actually link, they only depend on side effects of their dependencies. Therefore we can drop dependencies that contribute no side effects.