summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeTargetDepends.cxx
Commit message (Collapse)AuthorAgeFilesLines
* cmComputeComponentGraph: use `size_t` for component indicesBen Boeckel2023-01-311-56/+57
| | | | This avoids using casts everywhere when dealing with the sizes.
* cmComputeComponentGraph: use a name for "invalid component"Ben Boeckel2023-01-311-2/+2
| | | | This is to prepare for making the graph use `size_t`.
* 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
* Source: Fix clang -Wimplicit-fallthrough warningsSean McBride2021-09-281-0/+2
|
* Move helpers functions from cmStringAlgorithms.h to cmValue.hMarc Chevrier2021-09-211-1/+0
| | | | | Helpers functions related to cmValue semantic are now part of cmValue.h header.
* Rename cmProp in cmValueMarc Chevrier2021-09-211-2/+2
|
* Refactor: Convert parallel string/backtrace vectors to BT vectorsKyle Edwards2021-09-031-1/+1
|
* target_link_libraries: Place $<TARGET_OBJECTS> before librariesBrad King2021-05-291-0/+13
| | | | | | | | | 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
* cmComputeTargetDepends: Factor out helper to add object library dependencyBrad King2021-05-281-20/+29
|
* Code style: add missed explicit 'this->'Oleksandr Koval2021-01-051-1/+1
| | | | | CMake uses explicit 'this->' style. Using custom clang-tidy check we can detect and fix places where 'this->' was missed.
* Add option to optimize link dependencies for static librariesKyle Edwards2020-08-121-7/+156
| | | | | | | | | 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.
* Merge topic 'cmcomputecomponentgraph-compute-method'Brad King2020-07-291-0/+1
|\ | | | | | | | | | | | | bd0d03386b cmComputeComponentGraph: Move work out of constructor into Compute() method Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5079
| * 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.
* | cmComputeTargetDepends: Add missing nullptr checkBrad King2020-07-231-7/+9
| | | | | | | | Check the result of `GetLinkImplementation` before using it.
* | Factor out generator checks for filtering out interface librariesBrad King2020-07-231-5/+4
|/ | | | | | Add a `cmGeneratorTarget::IsInBuildSystem` helper method to tell generators whether a target should participate in the generated build system.
* cmMakefile: Refactor API to better handle empty config valuesRobert Maynard2020-07-031-1/+1
|
* Fix dependencies on targets linked through object librariesBrad King2020-03-041-13/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Ninja Multi-Config: Fix issue with framework dependencies and AutogenKyle Edwards2020-02-171-15/+22
| | | | Fixes: #20345
* cmLocalGenerator: modernize memory managementMarc Chevrier2019-12-091-3/+2
|
* cmLocalGenerator: modernize memory managementMarc Chevrier2019-11-111-5/+4
|
* Revise include order using clang-format-6.0Kitware Robot2019-10-011-5/+5
| | | | | 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.
* clang-tidy: modernize-deprecated-headersRegina Pfeifer2019-09-161-2/+2
|
* clang-tidy: modernize-use-autoRegina Pfeifer2019-09-101-5/+3
| | | | | | 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.
* cmMakefile: Add configurations getter with empty configuration defaultDaniel Eiband2019-08-301-5/+2
|
* cmRange: Move to dedicated header fileRegina Pfeifer2019-02-211-1/+1
|
* Modernize: Use ranged for-loops when possibleArtur Ryt2019-02-071-3/+3
| | | | | | | Replaced most manual `const_iterator`-based loops and some reverse-iterator loops with range loops. Fixes: #18858
* Merge topic 'tidy-use-equals-default'Brad King2019-01-291-3/+1
|\ | | | | | | | | | | | | | | | | 094f01d0f0 cleanup: Prefer compiler provided special member functions 55671b41d2 clang-tidy: Use `= default` Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Brad King <brad.king@kitware.com> Merge-request: !2841
| * clang-tidy: Use `= default`Regina Pfeifer2019-01-251-3/+1
| | | | | | | | | | | | Suppress some cases in `Source/cmGeneratorExpressionNode.cxx` and `Source/cmUVHandlePtr.h` where a few older compilers require a user-defined default constructor (with `{}`).
* | cmSystemTools::Error(): new overload accepting std::stringVitaly Stakhovsky2019-01-231-1/+1
|/
* Factor out enum MessageType into dedicated headerBruno Manganelli2019-01-161-3/+4
| | | | Reduce the number of files relying on `cmake.h`.
* Track backtraces in target dependencies internallyBrad King2018-10-181-13/+24
| | | | | 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-13/+7
| | | | | | 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.
* Fix dependency propagation through same-name imported targetsBrad King2018-09-071-23/+27
| | | | | | | | | | If two imported targets in different directories have the same name we should still be able to propagate transitive link dependencies from both. Fix the target and link dependency analyzers to de-duplicate targets using target pointers rather than target names since the pointers will not be duplicated even if the names are. Issue: #18345
* cmLinkItem: Convert to a "sum type" over a string and target pointerBrad King2018-09-071-4/+4
| | | | | | | | | Avoid exposing the item name implicitly as std::string. When the item is a target, avoid storing a second copy of its name. Most link item construction is paired with calls to `FindTargetToLink` to get the possible target pointer. Rename these methods to `ResolveLinkItem` and refactor them to construct the entire item.
* objlib: Allow other libraries to link to `OBJECT` libraries.Deniz Bahadir2018-03-011-3/+3
| | | | | | | | 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
* Reduce allocation of temporary values on heap.Pavel Solodovnikov2018-01-261-7/+6
| | | | | - Use `std::move` while inserting temporary results into vectors. - Change `push_back` to `emplace_back` where appropriate.
* Meta: modernize old-fashioned loops to range-based `for`.Pavel Solodovnikov2017-09-121-55/+42
| | | | | | Changes done via `clang-tidy` with some manual fine-tuning for the variable naming and `auto` type deduction where appropriate.
* Use C++11 nullptrDaniel Pfeifer2017-08-241-2/+2
|
* Performance: Add an index to Change cmLocalGenerator::GeneratorTargets.Aaron Orenstein2017-08-161-1/+1
| | | | | | | | | | | Add an index to Change cmLocalGenerator::GeneratorTargets for faster lookup by name. Also changed a bunch of uses of cmLocalGenerator::GetGeneratorTargets() to take const references instead of copying the vector. Represent generator targets as a map (name -> target) to make name lookups more efficient instead of looping through the entire vector to find the desired one.
* cmComputeTargetDepends: Avoid nested loops over configurationsBrad King2017-05-181-14/+6
| | | | | `AddInterfaceDepends` is only called from `CollectTargetDepends` inside our loop over all configurations so it doesn't need its own such loop.
* cmComputeTargetDepends: Avoid computing with empty configurationBrad King2017-05-181-1/+3
| | | | | | | Fix `AddInterfaceDepends` to combine all configurations using the same approach that `CollectTargetDepends` does. Fixes: #16896
* cmListFileCache: Remove cmState header includeStephen Kelly2016-10-191-0/+1
| | | | | Include it in dependents which have previously relied on it transitively.
* cmState: Port dependents to new cmStateTypes headerStephen Kelly2016-10-191-1/+1
|
* cmState: Move TargetType enum to separate namespaceStephen Kelly2016-10-191-10/+10
|
* Simplify CMake per-source license noticesBrad King2016-09-271-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
* fix a batch of include-what-you-use violationsDaniel Pfeifer2016-08-231-2/+9
|
* use CM_NULLPTRDaniel Pfeifer2016-06-281-2/+2
|
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-260/+182
| | | | | | | | | | | | | Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
* Remove `//------...` horizontal separator commentsBrad King2016-05-091-17/+0
| | | | | | | | | | | | | | | | | | | | | | | | Modern editors provide plenty of ways to visually separate functions. Drop the explicit comments that previously served this purpose. Use the following command to automate the change: $ git ls-files -z -- \ "*.c" "*.cc" "*.cpp" "*.cxx" "*.h" "*.hh" "*.hpp" "*.hxx" | egrep -z -v "^Source/cmCommandArgumentLexer\." | egrep -z -v "^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmDependsJavaLexer\." | egrep -z -v "^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmExprLexer\." | egrep -z -v "^Source/cmExprParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmFortranLexer\." | egrep -z -v "^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmListFileLexer\." | egrep -z -v "^Source/cm_sha2" | egrep -z -v "^Source/(kwsys|CursesDialog/form)/" | egrep -z -v "^Utilities/(KW|cm).*/" | xargs -0 sed -i '/^\(\/\/---*\|\/\*---*\*\/\)$/ {d;}' This avoids modifying third-party sources and generated sources.
* Format include directive blocks and ordering with clang-formatBrad King2016-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sort include directives within each block (separated by a blank line) in lexicographic order (except to prioritize `sys/types.h` first). First run `clang-format` with the config file: --- SortIncludes: false ... Commit the result temporarily. Then run `clang-format` again with: --- SortIncludes: true IncludeCategories: - Regex: 'sys/types.h' Priority: -1 ... Commit the result temporarily. Start a new branch and cherry-pick the second commit. Manually resolve conflicts to preserve indentation of re-ordered includes. This cleans up the include ordering without changing any other style. Use the following command to run `clang-format`: $ git ls-files -z -- \ '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' | egrep -z -v '(Lexer|Parser|ParserHelper)\.' | egrep -z -v '^Source/cm_sha2' | egrep -z -v '^Source/(kwsys|CursesDialog/form)/' | egrep -z -v '^Utilities/(KW|cm).*/' | egrep -z -v '^Tests/Module/GenerateExportHeader' | egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' | xargs -0 clang-format -i This selects source files that do not come from a third-party. Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>