summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.h
Commit message (Collapse)AuthorAgeFilesLines
* Genex: Memoize usage requirement TARGET_PROPERTY existenceBrad King2019-07-231-0/+5
| | | | | | | | | | | | | | | For each usage requirement (such as `INTERFACE_COMPILE_DEFINITIONS` or `INTERFACE_INCLUDE_DIRECTORIES`), the value of the generator expression `$<TARGET_PROPERTY:target,prop>` includes the values of the same property from the transitive closure of link libraries of the target. In cases that a target's transitive closure of dependencies does not depend on the target being linked (the "head" target), we can memoize whether or not a usage requirement property exists at all for that target. When a usage requirement does not exist for a target, we can skip evaluating it for every consuming target. Fixes: #18964, #18965
* Genex: Optimize usage requirement TARGET_PROPERTY recursionBrad King2019-07-231-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In large projects the generation process spends a lot of time evaluating usage requirements through transitive interface properties on targets. This can be seen in a contrived example with deep dependencies: set(prev "") foreach(i RANGE 1 500) add_library(a${i} a.c) target_compile_definitions(a${i} PUBLIC A${i}) target_link_libraries(a${i} PUBLIC ${prev}) set(prev a${i}) endforeach() For each usage requirement (such as `INTERFACE_COMPILE_DEFINITIONS` or `INTERFACE_INCLUDE_DIRECTORIES`), the value of the generator expression `$<TARGET_PROPERTY:target,prop>` includes the values of the same property from the transitive closure of link libraries of the target. Previously we computed this by constructing a generator expression string like `$<TARGET_PROPERTY:lib,INTERFACE_COMPILE_DEFINITIONS>` and recursively evaluating it with the generator expression engine. Avoid the string construction and parsing by creating and using a dedicated evaluation method `cmGeneratorTarget::EvaluateInterfaceProperty` that looks up the properties directly. Issue: #18964, #18965
* De-duplicate checks for whether a platform uses Windows DLLsBrad King2019-07-121-1/+0
|
* Refactor checks for whether a target has an import libraryBrad King2019-07-121-2/+6
| | | | Use `HasImportLibrary` for such checks.
* BUILD_RPATH/INSTALL_RPATH: Add generator expression supportKyle Edwards2019-06-251-1/+7
| | | | Fixes: #19423
* Refactor: introduce method cmGeneratorTarget::GetFilePostfixMarc Chevrier2019-05-021-0/+3
|
* Refactor: Add new methods to retrieve prefix and suffixMarc Chevrier2019-04-101-0/+14
|
* Genex: Add capability to retrieve base name for various target artifactsMarc Chevrier2019-04-081-0/+3
| | | | This new capability is required to solve efficiently issue #18771
* Fix invalid ///! doxygen comment line startsSebastian Holtermann2019-03-311-3/+3
| | | | | In various places `///!` was used to start a comment line. This is not valid Doygen syntax. This patch replaces `///!` comment starts with `//!`.
* Create and use `cmGeneratorTarget::Names`Saleem Abdulrasool2019-02-111-6/+12
| | | | | | Rather than taking a number of out parameters for the various names, create a structure that is reused for both `GetLibraryNames` and `GetExecutableNames`. Replace uses according to the new interface.
* clang-tidy: Use `= delete`Regina Pfeifer2019-01-291-2/+3
|
* cleanup: Prefer compiler provided special member functionsRegina Pfeifer2019-01-251-5/+0
|
* clang-tidy: Use `= default`Regina Pfeifer2019-01-251-5/+5
| | | | | | Suppress some cases in `Source/cmGeneratorExpressionNode.cxx` and `Source/cmUVHandlePtr.h` where a few older compilers require a user-defined default constructor (with `{}`).
* cmTarget,cmGeneratorTarget: Add optional `before` parameter to AddSourceSebastian Holtermann2019-01-181-2/+2
| | | | | | The new optional `before` parameter in `cmTarget::AddSource` and `cmGeneratorTarget::AddSource` allows to prepend a source file to the sources list instead of appending it.
* clang-tidy: Use default member initializationRegina Pfeifer2018-12-151-31/+13
|
* POSITION_INDEPENDENT_CODE: Manage link flags for executablesMarc Chevrier2018-11-111-0/+5
| | | | Fixes: #14983, #16561
* Merge topic 'fix-custom-target-with-csharp'Brad King2018-11-011-5/+1
|\ | | | | | | | | | | | | | | | | 9040df31e2 Merge branch 'backport-fix-custom-target-with-csharp' 1acd1c2b50 CSharp: Fix regression in VS project type selection for custom target a56edad6d6 CSharp: Fix regression in VS project type selection for custom target Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2549
| * CSharp: Fix regression in VS project type selection for custom targetBrad King2018-10-311-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A target created by `add_custom_target` should always be a `.vcxproj` file even if it has `.cs` sources involved in custom commands and such. The latter case was broken by refactoring in commit v3.12.0-rc1~160^2~7 (remove TargetIsCSharpOnly() and use methods from cmGeneratorTarget, 2018-03-19). The reason is that the `HasLanguage` method added by commit v3.12.0-rc1~239^2~6 (cmGeneratorTarget: add HasLanguage() as wrapper for GetLanguages(), 2018-03-19) does not check the target type and so is not a suitable check for deciding the project file extension. The `HasLanguage` method was an attempt at an abstraction that turns out not to work very well. Replace it with a dedicated `IsCSharpOnly` method that considers the target type, sources, and non-transitive `LINKER_LANGUAGE`. Fixes: #18515
* | Add generator APIs to get build settings with backtracesBrad King2018-10-181-6/+25
| | | | | | | | | | | | In cmGeneratorTarget and cmLocalGenerator we offer several APIs to get build settings like include directories, compile definitions, source files, etc. Add corresponding APIs that include backtrace information.
* | add_dependencies: Track backtraces internallyBrad King2018-10-181-2/+1
| | | | | | | | | | Record backtraces for "utility" dependencies created by `add_dependencies` calls.
* | cmLinkItem: Add backtraceBrad King2018-10-181-1/+3
| | | | | | | | | | | | 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.
* | cmGeneratorTarget::GetExportMacro: return const std::string*Vitaly Stakhovsky2018-10-161-1/+1
|/
* Merge topic 'fix-csharp-target-type'Brad King2018-10-031-1/+1
|\ | | | | | | | | | | | | | | 375b420fdf CSharp: Fix regression in VS project type selection 8b21aa0af0 VS: Fix CSharp flag selection when linking to a static C++ library Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2427
| * CSharp: Fix regression in VS project type selectionBrad King2018-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A that target contains only `.cs` sources should be generated as a `.csproj` project even if it links to non-CSharp static libraries. The latter case was broken by refactoring in commit v3.12.0-rc1~160^2~7 (remove TargetIsCSharpOnly() and use methods from cmGeneratorTarget, 2018-03-19). The reason is that the `HasLanguage` method added by commit v3.12.0-rc1~239^2~6 (cmGeneratorTarget: add HasLanguage() as wrapper for GetLanguages(), 2018-03-19) enforces its "exclusive" check on the combined set of source file languages and the link language. To restore the original `TargetIsCSharpOnly` semantics, update `HasLanguage` to enforce exclusiveness only on the list of sources. Fixes: #18239
* | LINK_DIRECTORIES: Add new properties and commandsMarc Chevrier2018-09-251-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | cmGeneratorTarget: Factor target name resolution out of link item resolutionBrad King2018-09-121-0/+7
| |
* | cmLinkItem: Convert to a "sum type" over a string and target pointerBrad King2018-09-071-1/+1
| | | | | | | | | | | | | | | | | | 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.
* | static library: add property STATIC_LIBRARY_OPTIONSMarc Chevrier2018-08-151-0/+3
| | | | | | | | issue: #18251
* | Return std::string from cmGeneratorTarget::ImportedGetLocationSebastian Holtermann2018-07-111-1/+1
| |
* | Merge topic 'safe_property'Brad King2018-07-031-0/+3
|\ \ | | | | | | | | | | | | | | | | | | | | | 42cc0644d5 Autogen: Use default and remove custom GetSafeProperty functions 127094f2f0 Add GetSafeProperty method to cmTarget, cmGeneratorTarget and cmSourceFile Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2185
| * | Add GetSafeProperty method to cmTarget, cmGeneratorTarget and cmSourceFileSebastian Holtermann2018-07-021-0/+3
| | |
* | | LINK_DEPENDS: add support for property INTERFACE_LINK_DEPENDSMarc Chevrier2018-06-271-0/+4
|/ / | | | | | | Fixes: #17997
* | LINK_OPTIONS: Add new family of propertiesMarc Chevrier2018-06-061-0/+6
|/ | | | | | | | | | | | | | This family enable to manage link flags Three new properties: * directory property: LINK_OPTIONS * target properties: LINK_OPTIONS and INTERFACE_LINK_OPTIONS Two new commands * add_link_options(): to populate directory property * target_link_options(): to populate target properties Fixes: #16543
* Revise C++ coding style using clang-format-6.0Kitware Robot2018-06-011-5/+5
| | | | | | | | | | | | 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.
* cmGeneratorTarget: Make import library checks config-awareMichael Stürmer2018-04-051-4/+4
|
* cmGeneratorTarget: add GetManagedType() and CheckManagedType() methodsMichael Stürmer2018-04-051-0/+17
|
* cmGeneratorTarget: add HasLanguage() as wrapper for GetLanguages()Michael Stürmer2018-04-051-0/+6
|
* Genex: Fix COMPILE_LANGUAGE in SYSTEM include directoriesBrad King2018-03-121-1/+2
| | | | | | | | | When evaluating `INTERFACE_SYSTEM_INCLUDE_DIRECTORIES`, or evaluating `INTERFACE_INCLUDE_DIRECTORIES` on an imported target, thread the compile language through to the generator expression evaluator so that it can support `$<COMPILE_LANGUAGE:...>`. Fixes: #17811
* clang-format: format all code as Cpp11Daniel Pfeifer2017-08-301-1/+1
|
* IWYU: Mark cmConfigure.h with pragma: keepDaniel Pfeifer2017-08-261-1/+1
| | | | Also remove `#include "cmConfigure.h"` from most source files.
* Use C++11 nullptrDaniel Pfeifer2017-08-241-2/+2
|
* Autogen: Clear sources meta data cacheSebastian Holtermann2017-08-101-0/+5
| | | | | | | | | | | | | | | | | Adds cmGeneratorTarget::clearSourcesCache() which clears the cache of precomputed sources lists and object names. The cache gets recomputed on demand. Clearing the cache is necessary in case an OBJECT library gets a source added after a target (ORIGIN) that includes it computed it's external sources cache. This may happen in AUTOMOC when ORIGIN is processed before the OBJECT library which gets a mocs_compilation.cpp file added. Closes #17152 Closes #17139 Closes #17085 Closes #15967
* Diagnose object library self-referenceBrad King2017-07-141-0/+5
| | | | | | | | | | | | | | | | | | | The code add_library(A OBJECT a.c) target_sources(A PRIVATE $<TARGET_OBJECTS:A>) used to crash CMake via infinite recursion while evaluating the generator expression. Then the change in commit v3.9.0-rc1~266^2~1 (cmGeneratorTarget: Replace source classifier implementation, 2017-04-07) avoided the infinite recursion because GetKindedSources now creates a map entry and initializes it once. If it is called again on the same target during that initialization, the partially computed results are returned. This is still wrong but does not crash. Detect and diagnose this case instead. Co-Author: Ben Boeckel <ben.boeckel@kitware.com> Fixes: #16578
* IPO: Consider support for each language separatelyBrad King2017-06-141-2/+3
| | | | | | | | | We only define `INTERPROCEDURAL_OPTIMIZATION` behavior for C, CXX, and Fortran languages. Do not try to enable support for other languages. Furthermore, each language builds with a different compiler, so check for support by CMake and the compiler for each language independently. Fixes: #16944
* Features: Refactor <LANG>_STANDARD updateBrad King2017-05-011-0/+2
| | | | | | | | | In order to support generator expressions in target COMPILE_FEATURES we apply them at generate time. Move this step to the beginning of generation instead of doing it on demand while collecting flags. This avoids repeating the process unnecessarily, and will then allow `cmLocalGenerator::AddCompilerRequirementFlag` to be used any time during generation.
* Use CM_DISABLE_COPYDaniel Pfeifer2017-04-241-3/+2
|
* cmGeneratorTarget::SourceFileFlags: remove custom copy ctorDaniel Pfeifer2017-04-211-5/+0
|
* Merge topic 'enable_ptx_compilation'Brad King2017-04-211-0/+1
|\ | | | | | | | | | | | | 23691d78 CUDA: Allow sources to be compiled to .ptx files Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !725
| * CUDA: Allow sources to be compiled to .ptx filesRobert Maynard2017-04-201-0/+1
| | | | | | | | | | When the target property `CUDA_PTX_COMPILATION` is enabled CUDA OBJECT libraries will generate ptx files instead of object files.
* | Replace boolean `implib` parameters with enumGregor Jasny2017-04-201-16/+26
|/ | | | | Named enumeration values are much clearer at call sites and add more type safety.