summaryrefslogtreecommitdiffstats
path: root/Source/cmExportFileGenerator.h
Commit message (Collapse)AuthorAgeFilesLines
* export: Add initial CPS supportMatthew Woehlke2024-08-141-0/+5
| | | | | | | | | | | | | | | | | Add initial support for exporting (install only, for now) Common Package Specification (https://cps-org.github.io/cps/) format package descriptions. This has some limitations, such as not supporting generator expressions (as these cannot be portably exported), and only partially supporting transitive dependencies, but should be usable for at least some simple cases. (Actually, $<LINK_ONLY> is theoretically supportable, but is not yet implemented.) This still needs tests; these will be added in the next commit. Other potential improvements include support for language-specific compile definitions and inferring some package properties from project properties. Additionally, there is no module support yet; this is partly pending on having a tool agnostic format for providing the necessary information.
* export: Generalize GenerateImportFileConfigMatthew Woehlke2024-07-251-1/+2
| | | | | | | | | | Move some logic that is specific to CMake-format exports from GenerateImportFileConfig to an overload of GenerateImportConfig, so that the former can be moved (back) to the generic base class. This will allow it to also be used for Common Package Specification exports. To facilitate this, also add a method to get the format-specific character used to separate the export file base name from the config suffix, so that the rest of the logic to determine the file name can be shared.
* export: Refactor obtaining export informationMatthew Woehlke2024-07-251-0/+7
| | | | | | | | Refactor methods in the build and install export file generators to have the same, simplified API. Expose the resulting method as an abstract method on the base class, so that it can be called from mode-agnostic generators. While we're at it, refactor cmExportInstallFileGenerator's version to use std::any_of.
* export: Factor out CMake-specific export generation (2/2)Matthew Woehlke2024-07-231-123/+69
| | | | | | | | | | | | | | | | | | In order to support generation of Common Package Specifications, the mechanisms CMake uses to export package information need to be made more abstract. The prior commits began this refactoring; this continues by (actually) restructuring the classes used to generate the actual export files. To minimize churn, this introduces virtual base classes and diamond inheritance in order to separate logic which is format-agnostic but depends on the export mode (build-tree versus install-tree) from logic which is format-specific but mode-agnostic. This could probably be refactored further to use helper classes instead, and a future commit may do that, however an initial attempt to do that was proving even more invasive, such that this approach was deemed more manageable. While we're at it, add 'const' in more places where possible.
* export: Fix const placementMatthew Woehlke2024-07-181-20/+20
| | | | | | | | Use clang-format to fix placement of const qualifiers to be consistently right of the typename. The inconsistency was getting annoying, especially as the following refactor changes a lot of methods and sometimes adds const. (Being inconsistent within a file is not ideal, but in some cases there was inconsistency within single lines!)
* export: Factor out CMake-specific export generation (1/2)Matthew Woehlke2024-07-181-0/+2
| | | | | | | | | | | | | | | | In order to support generation of Common Package Specifications, the mechanisms CMake uses to export package information need to be made more abstract. As a first step toward this, refactor cmInstallExportGenerator so that logic specific to config.cmake and Android .mk lives in separate subclasses. While we're at it, clean up the code style a bit and try to use moves a bit more consistently. This is step 1 of 2. The next step will refactor the individual file generators along similar lines, which will also involve creating additional classes for format-agnostic logic that is shared between build-tree and install-tree variants.
* GenEx: Add support for custom transitive compile propertiesBrad King2024-05-211-0/+4
| | | | | | | | | Teach the `$<TARGET_PROPERTY:...>` generator expression to check for a new `TRANSITIVE_COMPILE_PROPERTIES` property in the target's link closure to enable transitive evaluation of named properties through the link closure, excluding entries guarded by `$<LINK_ONLY:...>`. Issue: #20416
* Merge branch 'backport-cxxmodules-export-file-collisions'Brad King2024-01-181-2/+3
|\
| * cxxmodules: make export trampoline script files uniqueBen Boeckel2024-01-181-2/+3
| | | | | | | | | | | | | | | | | | | | | | Include the name of the `EXPORT` in the filename when generating export information for C++ modules. This allows the same directory to be used for multiple sets of C++ module-using targets. For `export(TARGETS)` uses, generate a name based on the hash of the concatenation of the target names involved with the `export()` call. Fixes: #25609
* | install(EXPORT): Add ability to point to .xcframework fileKyle Edwards2023-11-151-5/+6
| | | | | | | | Issue: #25262
* | install(EXPORT): Export find_dependency() callsKyle Edwards2023-11-131-0/+13
| | | | | | | | | | | | Issue: #20511 Co-Authored-by: Brad King <brad.king@kitware.com> Co-Authored-by: Robert Maynard <rmaynard@nvidia.com>
* | cmExportFileGenerator: Add function to set required CMake versionKyle Edwards2023-11-131-3/+7
|/
* cxxmodules: include `INCLUDES DESTINATION` directoriesBen Boeckel2023-10-161-2/+4
| | | | | | | These paths are added outside the normal property management mechanisms. Shuttle the value to the C++ module export as needed. Fixes: #25289
* cmExportFileGenerator: export private compile info for C++ modulesBen Boeckel2023-08-171-0/+3
| | | | | | | | | When consuming exported targets which contain C++ modules, the consuming project must be able to recompile BMI files using the original target's flags. This is because a module source may use some private target usage requirement but not want to propagate it to consumers. To facilitate this, export the private information as necessary for consumers to be able to perform the BMI compilations.
* cmExport*FileGenerator: support exporting C++ module propertiesBen Boeckel2022-07-061-0/+5
| | | | | C++ module properties will be generated at build time, so generate code that includes the files actually responsible for the information.
* cmExportFileGenerator: Simplify collection of targets missing from export setBrad King2022-04-111-29/+20
| | | | | Store the list of missing target names in a member instead of threading an explicit reference to it through the call stack.
* export: Fix TARGET_NAME lookup for out-of-dir linkingBrad King2022-04-011-1/+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.
* Merge topic 'restore-target-export-includes'Brad King2022-02-101-1/+2
|\ | | | | | | | | | | | | | | 83d79636bf install(TARGETS): Restore per-export INCLUDES DESTINATION Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !6969
| * install(TARGETS): Restore per-export INCLUDES DESTINATIONEugene Shalygin2022-02-091-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 55e4753bbb (Refactor cmTargetExport removing InterfaceIncludeDirecories, 2021-07-20, v3.22.0-rc1~337^2~1) the storage of `INCLUDES DESTINATION` was moved into each target. However, a target may be installed in multiple exports, and their `INCLUDES DESTINATION` should not be mixed. Convert the IncludeDirectoriesEntries vector to a map and modify access function to store the directories lists with respect to cmExportTarget object. This fixes error when the same target is exported more than once via different exports and each for consequent export its include directories list grows. Add a test for this case. Fixes: #23183
* | install(EXPORT): Install file setsKyle Edwards2021-10-271-0/+12
|/
* Refactor export file generator intefaceEugene Shalygin2021-07-221-19/+18
| | | | | Replace cmTargetExport with const cmGeneratorTarget to allow recursive processing of exported targets and their link dependencies.
* 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.
* Source: use std::string in place of const char*Vitaly Stakhovsky2020-01-291-1/+1
|
* install,export: Do not treat language names as target namesBrad King2019-10-161-1/+7
| | | | | | | When generating `IMPORTED_LINK_INTERFACE_LANGUAGES`, do not treat the entries as target names. Fixes: #19846
* 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: Replace typedef with usingRegina Pfeifer2019-09-041-1/+1
| | | | | | | | Automate the conversion with perl -i -0pe 's/typedef ([^;]*) ([^ ]+);/using $2 = $1;/g' then manually fix a few places.
* clang-tidy: Use `= default`Regina Pfeifer2019-01-251-1/+1
| | | | | | Suppress some cases in `Source/cmGeneratorExpressionNode.cxx` and `Source/cmUVHandlePtr.h` where a few older compilers require a user-defined default constructor (with `{}`).
* LINK_DIRECTORIES: Add new properties and commandsMarc Chevrier2018-09-251-0/+4
| | | | | | | | | | | | These new capabilities enable to manage link directories Two new properties: * target properties: LINK_DIRECTORIES and INTERFACE_LINK_DIRECTORIES One new command * target_link_directories(): to populate target properties Fixes: #17215
* LINK_DEPENDS: add support for property INTERFACE_LINK_DEPENDSMarc Chevrier2018-06-271-0/+4
| | | | Fixes: #17997
* Export: allow exporting of additional propertiesWouter Klouwen2018-03-161-0/+4
| | | | | | | | | This change introduces an additional property that may be set on a target to allow additional properties to be exported. Normally only a limited number of properties are exported. Additional properties may be exported by simply setting the `EXPORT_PROPERTIES` property on a target that is exported.
* install,export: Maybe transform OBJECT libraries to INTERFACE librariesBrad King2018-02-281-1/+3
| | | | | | | | | | | Teach the `install` and `export` commands to support installing and exporting `OBJECT` libraries without their object files. Transform them to `INTERFACE` libraries in such cases. For `install(TARGETS)`, activate this when no destination for the object files is specified. For `export`, activate this only under Xcode with multiple architectures when we have no well-defined object file locations to give to clients.
* Use quotes for non-system includesDaniel Pfeifer2017-04-111-1/+1
| | | | | | | | | | | | | Automate with: git grep -l '#include <cm_' -- Source \ | xargs sed -i 's/#include <\(cm_.*\)>/#include "\1"/g' git grep -l '#include <cmsys/' -- Source \ | xargs sed -i 's/#include <\(cmsys\/.*\)>/#include "\1"/g' git grep -l '#include <cm[A-Z]' -- Source \ | xargs sed -i 's/#include <\(cm[A-Z].*\)>/#include "\1"/g'
* 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.
* Export: Virtualize file generation step helpersBill Hoffman2016-09-081-20/+21
| | | | Allow subclasses to override the actual content generation.
* Export: Factor out file generation steps into helpersBill Hoffman2016-09-081-0/+2
| | | | | Do not actually generate any content in the driving code paths. Use helpers for that.
* fix a load of include-what-you-use violationsDaniel Pfeifer2016-09-031-3/+11
|
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-62/+57
| | | | | | | | | | | | | 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.
* 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>
* Export: Port internal API to cmGeneratorTarget.Stephen Kelly2015-10-181-2/+3
|
* Export: Port internal utility to cmGeneratorTarget.Stephen Kelly2015-10-181-2/+2
|
* Export: Port some API to cmGlobalGenerator.Stephen Kelly2015-10-181-1/+0
|
* Export: Port interface to cmGeneratorTarget.Stephen Kelly2015-10-181-10/+13
|
* cmGeneratorTarget: Move GetInstallNameDir* from cmTarget.Stephen Kelly2015-08-051-1/+1
|
* Export: Port more API to cmGeneratorTarget.Stephen Kelly2015-08-051-1/+1
|
* Port some of the cmExportFileGenerator API to cmGeneratorTarget.Stephen Kelly2015-07-271-3/+5
| | | | | Enough to make it more possible to move GetLinkInterface to cmGeneratorTarget.
* Allow export of targets with INTERFACE_SOURCES.Stephen Kelly2015-02-101-0/+5
| | | | | | Use the same rules for paths in source and binary dirs in installed INTERFACE_SOURCES as are used for INTERFACE_INCLUDE_DIRECTORIES.
* cmExportFileGenerator: Make SetImportLinkProperty a templateBrad King2014-06-231-1/+3
| | | | | Allow the vector of property entries to have any element type that can convert to std::string.
* stringapi: Miscellaneous char* parametersBen Boeckel2014-03-081-1/+1
|
* stringapi: Pass configuration names as stringsBen Boeckel2014-03-081-7/+9
|
* strings: Remove cmStdString referencesBen Boeckel2014-03-081-1/+1
| | | | | | | | | | | Casts from std::string -> cmStdString were high on the list of things taking up time. Avoid such implicit casts across function calls by just using std::string everywhere. The comment that the symbol name is too long is no longer relevant since modern debuggers alias the templates anyways and the size is a non-issue since the underlying methods are generated since it's inherited.