summaryrefslogtreecommitdiffstats
path: root/Source/cmCommonTargetGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* cmCommonTargetGenerator: use modules from linked object-referenced targetsBen Boeckel2023-11-231-1/+12
| | | | | | | | Fortran modules provided by objects added as linked items via `$<TARGET_OBJECTS>` should also be considered as "linked targets" for collation purposes. As C++ modules have their own visibility rules through their `FILE_SET` feature, do not expose these for C++ module collation.
* cmCommonTargetGenerator: return forward linked target dirs tooBen Boeckel2023-11-211-29/+44
| | | | | This will be used for module forwarding in order to support `$<TARGET_OBJECTS>` usage in source and link libraries calls.
* cmCommonTargetGenerator: use modules from object-referenced targetsBen Boeckel2023-11-211-0/+8
| | | | | | | | Fortran modules provided by objects added as sources via `$<TARGET_OBJECTS>` should also be considered as "linked targets" for collation purposes. As C++ modules have their own visibility rules through their `FILE_SET` feature, do not expose these for C++ module collation.
* Merge branch 'backport-target-objects' into target-objectsBrad King2023-11-141-2/+8
|\
| * cmComputeLinkInformation: Track targets named by TARGET_OBJECTS sourcesBrad King2023-11-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * cmCommonTargetGenerator: Factor out GetLinkedTargetDirectories loop bodyBrad King2023-11-141-9/+8
| | | | | | | | Re-use the body in multiple loops instead of allocating to combine them.
* | cmCommonTargetGenerator: Drop unused local variableBrad King2023-11-141-1/+0
| |
* | Merge topic 'lint-genex-empty'Brad King2023-09-261-4/+1
|\ \ | |/ | | | | | | | | | | | | 80df7b1745 Linting: Fix empty evaluated genex Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !8833
| * Linting: Fix empty evaluated genexOrkun Tokdemir2023-09-251-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Update logic added by commit 099934e313 (Add generator expression support to static code analysis hooks, 2023-03-24, v3.27.0-rc1~261^2), and preserved by commit 993dde925f (TargetGenerator: Factor out generation of code check rules, 2023-05-12, v3.27.0-rc1~84^2~2), to handle a generator expression that evaluates to the empty string. If `<LANG>_CPPCHECK`, `<LANG>_CPPLINT`, `<LANG>_CLANG_TIDY`, or `<LANG>_INCLUDE_WHAT_YOU_USE` are empty after evaluating generator expressions, do not run their lints. Fixes: #25265
* | cmComputeLinkInformation: add `OBJECT` libraries as link itemsBen Boeckel2023-08-011-7/+1
| | | | | | | | | | | | This completes the transition started in commit b665966933 (cmComputeLinkInformation: track OBJECT library dependencies, 2023-07-22).
* | 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.
* cmComputeLinkInformation: track OBJECT library dependenciesBen Boeckel2023-07-221-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | In commit b6a5382217 (Ninja: depend on language module information files directly, 2023-02-10), introduced via !8197, language-specific module information files (`CMakeFiles/<target>.dir/<lang>Modules.json`) files were added as real dependencies to the dyndep collation steps. Previously, the behavior was to inform the collator of all possible targets and search for the files manually ignoring those which did not exist with ordering enforced by depending on the linker output of all dependent targets. This behavior could lead to stale information being used (e.g., if a target stops providing any targets) and also did not reliably build everything needed on rebuilds. Afterwards, the internal computation changed the dependency from all possible targets to an exact set of "these targets might have modules" query, however one that did not include `OBJECT` libraries since do not have `LinkEntry` items internally (their objects are instead treated as source files). As a stopgap measure, track `OBJECT` libraries in a separate list and query them explicitly when gathering targets which may have interesting information. Future work can add `LinkEntry` items to represent these targets once all `LinkEntry` consumers have been audited to make sure they are not surprised by any `OBJECT` library entries. Fixes: #25112
* Source: Fix -Wdangling-reference warnings exposed by gcc 13Brad King2023-05-221-1/+1
|
* TargetGenerator: Factor out generation of code check rulesOrkun Tokdemir2023-05-161-0/+165
| | | | | | | | De-duplicate code check rule generation in Ninja and Makefile generators by moving their implementation to `cmCommonTargetGenerator`. Previously Ninja was generating code check rules per language. It was changed to generate code check rules for each source file.
* CMake code rely on cmList class for CMake lists management (part. 1)Marc Chevrier2023-04-241-2/+2
|
* Merge topic 'module-depends-static-lib-cycle'Brad King2023-03-271-0/+3
|\ | | | | | | | | | | | | | | | | 01d7860fdb Ninja,Makefile: Restore Fortran module scanning in static library cycle 846baa7c5b cmGlobalGenerator: Factor out helper to check target ordering Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8363
| * Ninja,Makefile: Restore Fortran module scanning in static library cycleBrad King2023-03-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since * commit eed295fd8a (cmGlobalNinjaGenerator: require that dependency info files work, 2023-02-01, v3.26.0-rc1~1^2~1), and * commit 13810dee17 (cmDependsFortran: require that dependency info files work, 2023-02-01, v3.26.0-rc1~1^2), the Ninja and Makefile generators' module dependency scanning requires that scanning results from from linked targets is available before scanning the current target. In the case of a static library cycle, we cannot expect this information from other static libraries in the cycle. Previously we supported cyclic cases at the cost of silently ignoring missing information. We already compute a global order of targets that respects all `add_dependencies`, but may break `target_link_libraries` dependencies that occur in a static library cycle. Use this order to filter the linked targets so we only expect scanning results to be available from those targets that build before the current target. This approach is sufficient to support module dependency scanning in static library cycles as long as module dependencies do not cross between two libraries in the same cycle. Fixes: #24631
* | Apple: Handle generation and comsuption of text-based stubs (.tbd files)Marc Chevrier2023-03-011-1/+0
| | | | | | | | Fixes: #24123
* | Enhance support functionsMarc Chevrier2023-02-281-1/+1
| | | | | | | | | | * Avoid duplicate definiitions for IsExecutableWithExports, etc... * Add helper IsApple()
* | cmCommonTargetGenerator: also consider synthetic targetsBen Boeckel2023-02-141-1/+3
| |
* | Merge topic 'lang-linker-launcher-genex'Brad King2023-02-031-3/+11
|\ \ | |/ |/| | | | | | | | | | | | | 33e27f6ca6 <LANG>_LINKER_LAUNCHER: Allow generator expressions 84ada0b0c9 <LANG>_COMPILER_LAUNCHER: Expand subset of genexes that can be evaluated Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8152
| * <LANG>_LINKER_LAUNCHER: Allow generator expressionsKyle Edwards2023-02-021-3/+11
| |
* | cmCommonTargetGenerator: classify linked target directories by languageBen Boeckel2023-02-011-1/+6
|/ | | | | | | | | | | | | | | | | | | These directories are used to direct collators for Fortran and C++ modules to consume dependent module information to properly collate. However, the consumption of these files merely checks for existence of the file, not whether they are actually needed anymore. The problem arises when a target has Fortran or C++ modules at point A, a build occurs populating this file, and then the target is updated to no longer have potential modules. The `DependInfo.make` (for `Makefiles`) or `<LANG>DependInfo.json` (for `Ninja`) files still exist as they are never guaranteed to be cleaned up. This can introduce stale information to the build which may cause a false-positive compilation if a module file happens to still exist and gets found this way. Instead, query the `linked-target-dirs` using the language in question and only add the directory if it contains potential sources for modules coming from the language in question.
* cmCommonTargetGenerator: fix linked target directory for multi-config buildsBen Boeckel2022-06-141-0/+4
| | | | | Without this, `Ninja Multi-Config` generators were not getting the right directory to look for `<LANG>Modules.json` files for module information.
* cmLocalGenerator: Adopt AppendModuleDefinitionFlag methodBrad King2022-05-311-28/+0
| | | | Migrate from `cmCommonTargetGenerator::AddModuleDefinitionFlag`.
* Provide guidance when trying to use non-enabled languageRobert Maynard2022-05-041-1/+29
| | | | Fixes #23463
* Ninja: Avoid preprocessing twice with explicit Fortran_PREPROCESSPeter Hill2022-02-241-2/+5
| | | | | | Fix spurious warnings from gfortran+Ninja for preprocessing. Fixes: #23248
* Rename cmProp in cmValueMarc Chevrier2021-09-211-7/+7
|
* Clang: embed windows manifests with GNU interfaceThomas Bernard2021-09-161-4/+9
| | | | Solves: #22611
* Refactor: cmCommonTargetGenerator::GetFeature returns cmPropMarc Chevrier2021-08-091-3/+3
|
* Launchers: Support setting linker launchersBobby D Reynolds2021-05-281-0/+22
| | | | Fixes: #18316
* cmLocalCommonGenerator: Factor out relative path conversion helperBrad King2021-05-131-2/+1
|
* 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.
* cmMakefile::GetDefinition: return cmPropVitaly Stakhovsky2020-09-021-4/+4
|
* GetFeature(): return cmPropVitaly Stakhovsky2020-07-111-1/+1
|
* Single location for cmProp typedefVitaly Stakhovsky2020-06-011-0/+1
|
* Fortran: Add Fortran_PREPROCESS propertyPeter Hill2020-05-211-0/+28
| | | | Issue: #18870
* GetSafeProperty: return std::string const&Vitaly Stakhovsky2020-04-301-1/+1
|
* cmGeneratorTarget::GetProperty: return cmPropVitaly Stakhovsky2020-04-291-2/+2
|
* cmOutputConverter::GetFortranFormat(): delete const char* overloadVitaly Stakhovsky2020-04-271-3/+4
|
* cmSourceFile::GetProperty: return cmPropVitaly Stakhovsky2020-04-141-2/+2
|
* PCH: Add support for multi architecture iOS projectsCristian Adam2020-04-021-5/+8
| | | | Fixes: #20497
* macOS: Rename OSX_*_VERSION properties to MACHO_*_VERSIONBrad King2020-03-121-1/+1
| | | | | | | | | | | The properties added by commit 4a62e3d97c (macOS: Add OSX_COMPATIBILITY_VERSION and OSX_CURRENT_VERSION properties, 2020-01-24, v3.17.0-rc1~80^2~1) are general-purpose for all platforms using Mach-O formats and not just on OS X. Rename them accordingly. The properties are new to the CMake 3.17 release so we can rename them without compatibility concerns. Fixes: #20442
* AIX: Add an option to disable automatic exports from shared librariesBrad King2020-01-311-0/+15
| | | | | | | | | | Since commit 0f150b69d3 (AIX: Explicitly compute shared object exports for both XL and GNU, 2019-07-11, v3.16.0-rc1~418^2~2) we always export all symbols from shared libraries by default. Add a new target property called `AIX_EXPORT_ALL_SYMBOLS` that can be explicitly set to OFF to suppress this behavior and export no symbols by default. Fixes: #20290
* macOS: Add OSX_COMPATIBILITY_VERSION and OSX_CURRENT_VERSION propertiesIsuru Fernando2020-01-241-1/+4
| | | | Fixes: #17652
* Ninja: Add multi-config variantKyle Edwards2019-12-131-10/+15
| | | | Co-Authored-by: vector-of-bool <vectorofbool@gmail.com>
* Refactor: Prepare Ninja generator for multi-configKyle Edwards2019-12-131-23/+28
|
* Precompile Headers: Add REUSE_FROM signatureCristian Adam2019-09-171-0/+1
| | | | | | | Add the ability to share precompiled headers artifacts between targets. Fixes: #19659
* clang-tidy: modernize-use-autoRegina Pfeifer2019-09-101-3/+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.
* cmLocalGenerator: Remove AppendFlags 'const char*' overloadBrad King2019-09-051-1/+1
| | | | | Update call sites to ensure the `std::string` argument can be constructed safely.