summaryrefslogtreecommitdiffstats
path: root/Source/cmTargetLinkLibrariesCommand.cxx
Commit message (Collapse)AuthorAgeFilesLines
* CPS: Add Symbolic ComponentsTaylor Sasser2025-10-021-0/+5
| | | | | | | | | | | | | | Adds support for "symbolic" components, which represent feature-level capabilities of a package that do not correspond to actual build targets. These are modeled as pseudo-targets, using the INTERFACE type as a base, and can be queried via: get_target_property(... <tgt> "SYMBOLIC") This enables consumers to declare requirements on optional features (e.g., SSL support) even when they do not map to concrete targets. Fixes: #27187
* cmStrCat: combine neighboring arguments where possibleBen Boeckel2025-05-151-1/+1
| | | | Found using the `cmstrcat-adjacent-literals` rule for `ast-grep`.
* LICENSE: Replace references to Copyright.txt with LICENSE.rstKitware Robot2025-03-031-1/+1
| | | | | | | | | | ``` git grep -lz 'Copyright.txt or https://cmake.org/licensing ' | while IFS= read -r -d $'\0' f ; do sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / { s/Copyright.txt/LICENSE.rst/ }' "$f" ; done ```
* Revise C++ coding style using clang-format with "east const"Kitware Robot2025-01-231-5/+5
| | | | | | | | | | | | | | | Run the `clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`, now with "east const" enforcement. Use `clang-format` version 18. * 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. Issue: #26123
* Merge topic 'extern-domain'Brad King2025-01-221-1/+2
|\ | | | | | | | | | | | | | | e109307c43 Add support for foreign targets Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !10171
| * Add support for foreign targetsVito Gamberini2025-01-211-1/+2
| |
* | CMP0039: Remove support for OLD behaviorBrad King2025-01-191-23/+6
| |
* | CMP0023: Remove support for OLD behaviorBrad King2025-01-181-35/+16
| |
* | CMP0022: Remove support for OLD behaviorBrad King2025-01-181-65/+0
| |
* | CMP0016: Remove support for OLD behaviorBrad King2025-01-181-36/+5
|/
* Fix: A lot of typos in code found by `typos`Alex Turbov2025-01-121-1/+1
| | | | | | Yet another great code spellchecker: https://github.com/crate-ci/typos/ (Will be added later as a `pre-commit` hook)
* cmPolicies: Remove now-unused REQUIRED_IF_USED and REQUIRED_ALWAYS statesBrad King2024-11-131-10/+0
|
* cmTargetLinkLibrariesCommand: Optimize `ostream::operator<<` callsAlex Turbov2024-10-211-8/+8
|
* Fix crash in target-specific commands called from initial cache scriptBrad King2024-06-011-2/+1
| | | | Fixes: #26018
* 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.
* cmGeneratorExpressionNode: implement `COMPILE_ONLY` genexBen Boeckel2023-04-121-0/+1
| | | | | | | | | | | | | | | | This generator expression is the inverse of `LINK_ONLY` and only coveys usage requirements for the purposes of compilation. Its intended use is to avoid needing to export targets that do not have link usage requirements (e.g., header-only libraries) when used by another target. It will also be used to represent private usage requirements on exported C++ module-containing targets in the future. Eventually there should be logic to collapse nesting of `$<COMPILE_ONLY>` and `$<LINK_ONLY>` when generating instances of either. A TODO is left in the code for this case. See: #15415
* Merge topic 'check-library-properties-fix-performances-regression'Brad King2022-09-091-3/+0
|\ | | | | | | | | | | | | | | 985b4c82a6 Check link libraries properties: fix performances regression a47eef32a3 renames method FinalizeTargetCompileInfo() in FinalizeTargetConfiguration(). Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7651
| * Check link libraries properties: fix performances regressionMarc Chevrier2022-09-071-3/+0
| | | | | | | | Fixes: #23939
* | target_*: Fix cross-directory call backtracesBrad King2022-08-221-3/+5
|/ | | | | | | Record the call-site backtrace, not the current backtrace of the target's directory. Fixes: #23873
* cmSystemTools: Fix 'ErrorOccurred' spellingFeRD (Frank Dana)2022-06-131-2/+2
| | | | | | | | Rename the booleans 's_ErrorOccured' and 's_FatalErrorOccured' to 's_ErrorOccurred' and 's_FatalErrorOccurred', respectively. Rename the getters and setters to 'Get[Fatal]ErrorOccurred' and 'Set[Fatal]ErrorOccurred', and fix all uses across the codebase.
* Merge topic 'tll-genex-concat'Brad King2022-03-171-2/+27
|\ | | | | | | | | | | | | | | add64399c5 target_link_libraries: Restore LINK_ONLY for multiple static lib dependencies Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !7078
| * target_link_libraries: Restore LINK_ONLY for multiple static lib dependenciesBrad King2022-03-161-2/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit c1e812ad4f (target_link_libraries: Improve tolerance of unquoted generator expressions, 2022-02-15, v3.23.0-rc2~11^2) we accumulate consecutive non-keyword arguments to recover an unquoted generator expression as a single entry. When given multiple consecutive non-genex library names, the grouping breaks our logic that expects each entry is either a raw target name or a genex. Revise the logic to only accumulate multiple arguments when they end inside a partial genex. This bug caused `target_link_libraries` to stop wrapping static library private dependencies in `$<LINK_ONLY:...>` for `INTERFACE_LINK_LIBRARIES` when multiple consecutive library names are given. Add a test case covering that behavior. Fixes: #23302
* | Merge topic 'tll-genex-concat'Brad King2022-02-161-102/+138
|\ \ | |/ | | | | | | | | | | | | | | | | c1e812ad4f target_link_libraries: Improve tolerance of unquoted generator expressions 5571a31648 target_link_libraries: Handle keyword arguments in dedicated code path 42590df9f9 target_link_libraries: Remove likely-broken ancient compatibility check Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !6989
| * target_link_libraries: Improve tolerance of unquoted generator expressionsBrad King2022-02-151-4/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to commit 1d709ea2f5 (cmGeneratorTarget: Propagate backtraces from INTERFACE_LINK_LIBRARIES, 2021-12-15, v3.23.0-rc1~228^2), the value of `INTERFACE_LINK_LIBRARIES` was a single string. If an unquoted generator expression passed to `target_link_libraries` contained `;` and became multiple arguments, they would all accumulate as a single `;`-separated list in the value of `INTERFACE_LINK_LIBRARIES`. Since that commit, each argument to `target_link_libraries` is placed in `INTERFACE_LINK_LIBRARIES` as a separate entry, as has long been the case for `LINK_LIBRARIES`. That behavior change broke projects that were accidentally relying on accumulation in `INTERFACE_LINK_LIBRARIES` to produce complete generator expressions containing `;`. Teach `target_link_libraries` to accumulate consecutive non-keyword arguments into a single entry before placing them in `LINK_LIBRARIES` or `INTERFACE_LINK_LIBRARIES`. For example, treat `a b c` as if they were written as `"a;b;c"`. This restores the previously accidental support for unquoted generator expressions in `INTERFACE_LINK_LIBRARIES`, and also enables it for `LINK_LIBRARIES`. For now, do not drop the `target_link_libraries` documentation that recommends quoting generator expressions. Quoting is still important to populate `LINK_LIBRARIES` in CMake 3.22 and below, and is also good practice to keep generator expressions whole. Fixes: #23203
| * target_link_libraries: Handle keyword arguments in dedicated code pathBrad King2022-02-151-83/+100
| |
| * target_link_libraries: Remove likely-broken ancient compatibility checkBrad King2022-02-151-18/+3
| | | | | | | | | | | | | | | | | | Since commit daa6d2bc04 (ENH: updated handling of debug and optimized target link libraries, 2006-11-29, v2.6.0~2471) the ancient `<lib>_LINK_TYPE` compatibility lookup was done using the name of the dependent target for which `target_link_libraries` is called, rather than the name of the library dependency being considered. This code probably does nothing. Remove it.
* | Genex: Add $<LINK_LIBRARY:...>Marc Chevrier2022-02-071-0/+3
|/ | | | | | | | 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
* Source: Fix clang -Wimplicit-fallthrough warningsSean McBride2021-09-281-0/+4
|
* Rename cmProp in cmValueMarc Chevrier2021-09-211-2/+2
|
* cmGeneratorTarget: Refactor link item lookupBrad King2021-05-281-1/+1
| | | | | Look up items individually so the call sites can do something with the result besides appending to a vector.
* cmMakefile: Inline GetExecutionContext at call sitesBrad King2020-09-281-1/+2
| | | | | The method only had one line, and its implementation is more clear at the call sites than the method name.
* cmMakefile::GetDefinition: return cmPropVitaly Stakhovsky2020-09-021-4/+4
|
* Merge topic 'out-of-dir-link-list'Brad King2020-01-171-82/+118
|\ | | | | | | | | | | | | | | | | f0e67da061 target_link_libraries: Fix out-of-dir linking of a list of targets acee629103 cmTargetLinkLibrariesCommand: Move HandleLibrary to helper struct ba675f1ecc Tests: Enable CMP0022 in ExportImport out-of-dir linking case Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4226
| * target_link_libraries: Fix out-of-dir linking of a list of targetsBrad King2020-01-161-27/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In a case like target_link_libraries(targetInOtherDir PUBLIC "$<1:a;b>") then all entries in the list need to be looked up in the caller's scope. Previously our `::@(directory-id)` suffix would apply only to the last entry. Instead surround the entire entry by a pair `::@(directory-id);...;::@` so that the `::@` syntax can encode a directory lookup scope change evaluated as the list is processed. Fixes: #20204
| * cmTargetLinkLibrariesCommand: Move HandleLibrary to helper structBrad King2020-01-161-65/+82
| |
* | cmMakefile: modernize memory managementMarc Chevrier2020-01-141-4/+3
|/
* target_link_libraries: Add FIXME comment for out-of-dir genex listBrad King2020-01-101-0/+4
| | | | Issue: #20204
* cmTarget: add std::string overloadsVitaly Stakhovsky2019-12-141-6/+5
|
* cmTargetLinkLibrariesCommand: Port away from cmCommandRegina Pfeifer2019-09-211-123/+138
|
* Refactor: Use cmStrCat to construct error stringsAsit Dhal2019-09-181-35/+39
| | | | | Replace string construction using std::stringstream with cmStrCat and cmWrap.
* clang-tidy: modernize-deprecated-headersRegina Pfeifer2019-09-161-1/+1
|
* Source sweep: Use cmStrCat for string concatenationSebastian Holtermann2019-08-221-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)`
* Merge topic 'out-of-dir-linking-private-deps'Brad King2019-05-011-2/+2
|\ | | | | | | | | | | | | 3d3713121b target_link_libraries: Fix static library private deps in other dirs Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3276
| * target_link_libraries: Fix static library private deps in other dirsBrad King2019-04-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | In commit a1ad0a699b (target_link_libraries: Allow use with targets in other directories, 2018-09-07, v3.13.0-rc1~94^2) we accidentally broke the logic that adds `$<LINK_ONLY:...>` to private dependencies of static libraries in their `INTERFACE_LINK_LIBRARIES` in the case that the dependency is added from outside the directory creating the library. The check for a valid target name should apply to the original name specified by the caller and not the encoded cross-directory reference. Fixes: #19197
* | Factor out enum MessageType into dedicated headerBruno Manganelli2019-01-161-26/+27
| | | | | | | | Reduce the number of files relying on `cmake.h`.
* | target_link_libraries: Propagate dependencies of object librariesKyle Edwards2018-12-101-1/+2
| | | | | | | | | | | | | | | | | | Prior to this commit, linking against an object library did not propagate private link dependencies of object libraries to their consuming targets. This change implements the correct behavior. Fixes: #18692 Co-Author: Brad King <brad.king@kitware.com>
* | clang-tidy: Fix readability-static-accessed-through-instanceRegina Pfeifer2018-11-211-3/+5
|/ | | | Enable the check in .clang-tidy and fix all warnings.
* target_link_libraries: Allow use with targets in other directoriesBrad King2018-09-121-22/+58
| | | | | | | | | | | | | | | | | | | | | Previously the command did not allow naming targets on the LHS that were not created in the calling directory. Lift this restriction to enable more flexible use by projects. Targets named on the RHS will need to be looked up during generation in the scope of the call site rather than the scope of the LHS target. Introduce an internal syntax in `[INTERFACE_]LINK_LIBRARIES` properties to specify target names that need to be looked up in a directory other than that containing the target on which the property is set. Add minimal documentation of the syntax to help users that encounter it. Unfortunately CMake previously did allow such calls in the case that only `INTERFACE` libraries are specified, but those libraries would be looked up in the target's directory rather than the caller's. Add policy `CMP0079` to enable the new behavior with new lookup scope in a compatible way. Fixes: #17943
* Revert "target_link_libraries: Allow use with targets in other directories"Brad King2018-07-031-9/+2
| | | | | | | | | Revert commit v3.12.0-rc1~82^2 (target_link_libraries: Allow use with targets in other directories, 2018-05-11). The RHS target scoping and visibility rules are not clear and will need further investigation before the feature can be added. Issue: #17943
* Revise C++ coding style using clang-format-6.0Kitware Robot2018-06-011-2/+3
| | | | | | | | | | | | Run the `clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`. Use `clang-format` version 6.0. * 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.