summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeLinkDepends.cxx
Commit message (Collapse)AuthorAgeFilesLines
* LINK_LIBRARY-genex: correct behavior for INTERFACE_LINK_LIBRARIES_DIRECTMarc Chevrier2023-11-291-62/+45
| | | | Fixes: #25416
* Merge topic 'fortran-objects-as-sources-fix'Brad King2023-11-271-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | beb1393f8f Merge branch 'revert-exact-collation-depends-3.27' into fortran-objects-as-sources-fix a033dce326 Makefiles: provide, but do not consume, "forward linked" target dirs 7cd0adab1b cmCommonTargetGenerator: use modules from linked object-referenced targets 1175f1c874 LinkItem: track `cmSourceFile` instances for external objects d2fa56772f Ninja: support "forwarding" modules from other targets ec1e589bec Ninja: Revert exact collation dependencies for 3.27 06df59b930 cmCommonTargetGenerator: return forward linked target dirs too f8729ab366 cmLocalUnixMakefileGenerator3: handle object-referencing Fortran modules ... Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8989
| * LinkItem: track `cmSourceFile` instances for external objectsBen Boeckel2023-11-231-0/+1
| | | | | | | | | | The target may be required in order to provide Fortran modules, so track the source file so that the target may be looked up when needed.
* | Merge branch 'backport-ci-fedora-39' into ci-fedora-39Brad King2023-11-171-1/+1
|\ \ | |/
| * codespell: Fix typosBrad King2023-11-171-2/+2
| |
* | Merge topic 'target-objects'Brad King2023-11-151-20/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | d7988ff6b8 Merge branch 'backport-target-objects' into target-objects 1814853081 cmCommonTargetGenerator: Drop unused local variable 377b78aef9 cmComputeLinkInformation: Simplify recording OBJECT libraries as link items 50fdaf8f1f cmComputeLinkInformation: Track targets named by TARGET_OBJECTS sources 0e26bd334d cmCommonTargetGenerator: Factor out GetLinkedTargetDirectories loop body Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com> Merge-request: !8974
| * Merge branch 'backport-target-objects' into target-objectsBrad King2023-11-141-20/+2
| |\
| | * cmComputeLinkInformation: Track targets named by TARGET_OBJECTS sourcesBrad King2023-11-141-20/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit b6a5382217 (Ninja: depend on language module information files directly, 2023-02-10, v3.27.0-rc1~502^2), the return value of `cmCommonTargetGenerator::GetLinkedTargetDirectories` must account for linked object libraries because they may provide modules (#25112). These were added by commit b665966933 (cmComputeLinkInformation: track OBJECT library dependencies, 2023-07-22, v3.27.1~5^2). However, targets named by `$<TARGET_OBJECTS:...>` sources are also needed (#25365). The latter were added by commit 22da18b995 (Fortran: Restore support for TARGET_OBJECTS providing modules, 2023-10-27, v3.28.0-rc4~9^2) and commit 035302b7e3 (cmComputeLinkDepends: also copy the target from object link items, 2023-10-27, v3.28.0-rc4~9^2~2). However, their approach added link entries not actually specified by projects. It also incorrectly re-used `cmComputeLinkDepends::AddLinkObject` for object library targets when it is meant for their individual object files. These problems caused additional regressions (#25417). Revert the implementation parts of those commits and leave behind an assertion and comment to help avoid the mistake in the future. Instead, track targets named by `$<TARGET_OBJECTS:...>` sources with a dedicated member. Issue: #25112 Issue: #25365 Fixes: #25417 Co-authored-by: Ben Boeckel <ben.boeckel@kitware.com>
| * | Merge topic 'modules-depends-via-target-objects' into release-3.28Brad King2023-10-311-0/+20
| |\ \ | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 22da18b995 Fortran: Restore support for TARGET_OBJECTS providing modules 64d9240564 cmComputeLinkInformation: skip over linking to items for object purposes 035302b7e3 cmComputeLinkDepends: also copy the target from object link items 861876b936 Tests/ObjectLibrary: fix comment Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Acked-by: scivision <michael@scivision.dev> Merge-request: !8923
* | | Link step: Enable to configure deduplication of librariesMarc Chevrier2023-11-091-2/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | Some platforms, Apple or Windows for instance, do not require to duplicate static libraries to resolve mutual dependencies. Moreover, Xcode version 15 emits a warning if a library is duplicated. On Windows, enable a better control of libraries order. Fixes: #20722, #25297
* | | Link Step: Introduce EntriesProcessing classMarc Chevrier2023-11-081-43/+136
| | | | | | | | | | | | | | | This refactoring is done in preparation of the possibility to configure the deduplication of the libraries as well as the order on the link command.
* | | Merge topic 'modules-depends-via-target-objects'Brad King2023-10-311-0/+20
|\ \ \ | |/ / |/| / | |/ | | | | | | | | | | | | | | | | 22da18b995 Fortran: Restore support for TARGET_OBJECTS providing modules 64d9240564 cmComputeLinkInformation: skip over linking to items for object purposes 035302b7e3 cmComputeLinkDepends: also copy the target from object link items 861876b936 Tests/ObjectLibrary: fix comment Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Acked-by: scivision <michael@scivision.dev> Merge-request: !8923
| * Fortran: Restore support for TARGET_OBJECTS providing modulesBen Boeckel2023-10-301-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | Continue b665966933 (cmComputeLinkInformation: track OBJECT library dependencies, 2023-07-22) which added explicitly listed `OBJECT` libraries to the list of targets which the collator needs to consider. Now also consider targets which provide objects directly to the target via a `$<TARGET_OBJECT>` source lists. Also add tests which use target objects directly and through an `INTERFACE` library with target objects in its own sources. Fixes: #25365
| * cmComputeLinkDepends: also copy the target from object link itemsBen Boeckel2023-10-271-0/+1
| |
* | IWYU: Update for Debian 12 CI jobBrad King2023-07-281-0/+1
|/ | | | | | `include-what-you-use` diagnostics, in practice, are specific to the environment's compiler and standard library. Update includes to satisfy IWYU for our CI job under Debian 12.
* CMake code rely on cmList class for CMake lists management (part. 1)Marc Chevrier2023-04-241-1/+2
|
* cmComputeComponentGraph: use `size_t` for component indicesBen Boeckel2023-01-311-50/+53
| | | | This avoids using casts everywhere when dealing with the sizes.
* cmComputeComponentGraph: use a name for "invalid component"Ben Boeckel2023-01-311-10/+17
| | | | This is to prepare for making the graph use `size_t`.
* cmValue: Use operator* explicitly to convert to std::string; avoid extra callVitaly Stakhovsky2023-01-161-3/+3
|
* LINK_LIBRARIES: Evaluate separately for linking and usage requirementsBrad King2022-03-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | 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-LINK_GROUP: Add possibility to group libraries at link stepMarc Chevrier2022-02-281-70/+363
| | | | Fixes: #23121
* cmComputeDepends::LinkEntry: introduce enum to specify item typeMarc Chevrier2022-02-251-7/+9
|
* genex-LINK_LIBRARY: rename configuration variablesMarc Chevrier2022-02-161-6/+7
| | | | | | To be more consistent between genex and variables as well as the forecomming LINK_GROUP genex, rename variable *_LINK_USING_<FEATURE>* in *_LINK_LIBRARY_USING_<FEATURE>*
* $<LINK_LIBRARY>: Add LINK_LIBRARY_OVERRIDE target propertyMarc Chevrier2022-02-081-16/+74
| | | | | | To enable the management of incompatible $<LINK_LIBRARY> declarations, add LINK_LIBRARY_OVERRIDE and LINK_LIBRARY_OVERRIDE_<LIBRARY> target properties.
* Genex: Add $<LINK_LIBRARY:...>Marc Chevrier2022-02-071-34/+143
| | | | | | | | 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
* Rename cmProp in cmValueMarc Chevrier2021-09-211-3/+3
|
* Refactor: Convert parallel string/backtrace vectors to BT vectorsKyle Edwards2021-09-031-1/+1
|
* HIP: Automatically inject the `hip::device` runtime targetRobert Maynard2021-06-071-0/+14
| | | | | Any target that might need to link to hip code needs the `hip::device` target
* target_link_libraries: Place $<TARGET_OBJECTS> before librariesBrad King2021-05-291-0/+36
| | | | | | | | | 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
* cmMakefile::GetDefinition: return cmPropVitaly Stakhovsky2020-09-021-6/+6
|
* cmComputeComponentGraph: Move work out of constructor into Compute() methodKyle Edwards2020-07-281-0/+1
| | | | | | The computation of Tarjan's algorithm is an expensive operation which should not be done in the constructor. Move this work into a dedicated Compute() method, and call this method explicitly.
* Fix typos identified using codespellJean-Christophe Fillion-Robin2020-07-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See https://github.com/codespell-project/codespell#readme The following command was used: ``` codespell -q6 --skip="\ .git,\ *.json,\ ./Copyright.txt,\ ./Help/command/foreach.rst,\ ./Help/prop_test/REQUIRED_FILES.rst,\ ./Help/variable/CTEST_COVERAGE_COMMAND.rst,\ ./Modules/CMakeCheckCompilerFlagCommonPatterns.cmake,\ ./Modules/CMakeRCInformation.cmake,\ ./Modules/Internal/CPack/NSIS.template.in,\ ./Modules/FindMatlab.cmake,\ ./Modules/MatlabTestsRedirect.cmake,\ ./Modules/Platform/Windows-Clang.cmake,\ ./Modules/Platform/Windows-Intel-Fortran.cmake,\ ./Modules/Platform/Windows-MSVC.cmake,\ ./Source/CMakeVersion.cmake,\ ./Source/cmConvertMSBuildXMLToJSON.py,\ ./Source/cmCreateTestSourceList.cxx,\ ./Source/cmGlobalVisualStudio10Generator.cxx,\ ./Source/cmExportBuildFileGenerator.cxx,\ ./Source/cmExportInstallAndroidMKGenerator.cxx,\ ./Source/cmExportInstallFileGenerator.cxx,\ ./Source/cmExportSet.cxx,\ ./Source/cmExportTryCompileFileGenerator.cxx,\ ./Source/cmFindPackageCommand.cxx,\ ./Source/cmInstallCommand.cxx,\ ./Source/cmGeneratorExpressionLexer.cxx,\ ./Source/cmLocalVisualStudio7Generator.cxx,\ ./Source/cmOrderDirectories.cxx,\ ./Source/cmTarget.cxx,\ ./Source/kwsys/*,\ ./Source/QtDialog/CMakeSetupDialog.ui,\ ./Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx,\ ./Source/CTest/cmParseCoberturaCoverage.h,\ ./Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in,\ ./Tests/RunCMake/CPack/tests/DMG_SLA/English.license.rtf,\ ./Tests/RunCMake/CPack/tests/DMG_SLA/German.license.txt,\ ./Tests/RunCMake/CPack/tests/DMG_SLA/German.menu.txt,\ ./Tests/RunCMake/GoogleTest/xml_output.cpp,\ ./Tests/RunCMake/Make/TargetMessages*,\ ./Utilities/*,\ " \ -L "\ dependees,\ endwhile,\ fo,\ filetest,\ helpfull,\ nd,\ objext,\ stoll,\ supercedes,\ superceded,\ vas,\ varn,\ " ```
* Ninja Multi-Config: Fix issue with framework dependencies and AutogenKyle Edwards2020-02-171-3/+3
| | | | Fixes: #20345
* Propagate backtraces from LINK_LIBRARIES through to link line itemsBrad King2020-02-101-8/+9
| | | | | | | | | | | | | Since commit d4d0dd0f6a (cmLinkLineComputer: Add ComputeLinkLibs overload with backtraces, 2019-09-13, v3.16.0-rc1~87^2~4), backtraces have been collected by `ComputeLinkLibs` by looking back through the link implementation libraries for one matching the text of the link line item. This is slow in projects with long link lines. Instead, teach `cmComputeLinkDepends` and `cmComputeLinkInformation` to carry backtrace information explicitly along with the text of each item. Fixes: #20322
* Revise include order using clang-format-6.0Kitware Robot2019-10-011-10/+10
| | | | | 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.
* Merge topic 'cmake-system-headers'Brad King2019-09-201-1/+1
|\ | | | | | | | | | | | | | | 4a08690ccf cmstd: Extend header <cm/iterator> c688b401d3 cmstd: Modernize CMake system headers Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3776
| * cmstd: Modernize CMake system headersMarc Chevrier2019-09-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide a standardized way to handle the C++ "standard" headers customized to be used with current CMake C++ standard constraints. Offer under directory `cm` headers which can be used as direct replacements of the standard ones. For example: #include <cm/string_view> can be used safely for CMake development in place of the `<string_view>` standard header. Fixes: #19491
* | cmComputeLinkDepends: remove manual memory deallocationTushar Maheshwari2019-09-181-13/+9
|/ | | | | - Replace owning raw `DependSetList` pointer with direct object. - Use an extra `bool Initialized` flag to imitate `nullptr` semantics.
* clang-tidy: modernize-deprecated-headersRegina Pfeifer2019-09-161-3/+3
|
* clang-tidy: modernize-use-autoRegina Pfeifer2019-09-101-7/+4
| | | | | | Set the MinTypeNameLength option to an impossibly high value in order to limit the diagnostics to iterators. Leave new expressions and cast expressions for later.
* Source sweep: Replace cmExpandList with the shorter cmExpandedListSebastian Holtermann2019-08-231-2/+1
| | | | | | | | | | | | This replaces the code pattern ``` std::vector<std::string> args; cmExpandList(valueStr, args, ...) ``` with ``` std::vector<std::string> args = cmExpandedList(valueStr, ...) ```
* Source sweep: Use cmStrCat for string concatenationSebastian Holtermann2019-08-221-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)`
* Source code: Use cmExpandList instead of cmSystemTools::ExpandListArgumentSebastian Holtermann2019-08-141-2/+1
|
* cmStringAlgorithms: Move string functions to the new cmStringAlgorithms.hSebastian Holtermann2019-07-291-0/+1
| | | | | This adds the `cmStringAlgorithms.h` header and moves all string functions from `cmAlgorithms.h` to `cmStringAlgorithms.h`.
* Introduce memory management helper: cm_memory.hxxMarc Chevrier2019-07-141-0/+2
|
* modermize: replace some raw pointers w/ `unique_ptr`Alex Turbov2019-06-241-2/+2
|
* cmRange: Move to dedicated header fileRegina Pfeifer2019-02-211-0/+1
|
* Modernize: Use ranged for-loops when possibleArtur Ryt2019-02-071-12/+6
| | | | | | | Replaced most manual `const_iterator`-based loops and some reverse-iterator loops with range loops. Fixes: #18858
* Track backtraces in target dependencies internallyBrad King2018-10-181-3/+8
| | | | | Carry backtraces on target dependency edges to refer to the line in project code that caused the edge to appear.
* cmLinkItem: Add backtraceBrad King2018-10-181-1/+2
| | | | | | Carry a backtrace on every link item, not just link implementation items. For now the non-impl items will still have empty backtraces at runtime, but this will allow us to introduce values over time.