summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
Commit message (Collapse)AuthorAgeFilesLines
* clang-tidy: modernize-deprecated-headersRegina Pfeifer2019-09-161-5/+5
|
* Merge topic 'modernize-use-auto'Brad King2019-09-121-28/+19
|\ | | | | | | | | | | | | d25a5a7ec9 clang-tidy: modernize-use-auto Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3783
| * clang-tidy: modernize-use-autoRegina Pfeifer2019-09-101-28/+19
| | | | | | | | | | | | 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.
* | Merge topic 'MoveIfDifferent'Brad King2019-09-101-4/+2
|\ \ | |/ |/| | | | | | | | | | | 5b96fd5b81 use cmSystemTools::MoveFileIfDifferent() 5eaf1e1be2 cmSystemTools: introduce MoveFileIfDifferent() Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3794
| * use cmSystemTools::MoveFileIfDifferent()Rolf Eike Beer2019-09-091-4/+2
| | | | | | | | | | | | | | | | | | | | This is better than doing CopyFileIfDifferent() followed by RemoveFile() in two ways: - it is more efficient, as it avoids disk I/O for the data, even if the files here are usually small - it is atomic, so an abort during the copy will not leave a destination file with partial data behind
* | clang-tidy: modernize-return-braced-init-listRegina Pfeifer2019-09-061-23/+20
|/
* clang-tidy: Replace typedef with usingRegina Pfeifer2019-09-041-2/+2
| | | | | | | | Automate the conversion with perl -i -0pe 's/typedef ([^;]*) ([^ ]+);/using $2 = $1;/g' then manually fix a few places.
* clang-tidy: Replace typedef with usingRegina Pfeifer2019-09-031-1/+1
|
* IWYU: Add missing cstddef includes for size_t and nullptr_tBrad King2019-09-031-0/+1
| | | | The IWYU tool we use for CI now diagnoses these.
* Merge topic 'add-non-empty-configurations-getter'Brad King2019-09-031-20/+8
|\ | | | | | | | | | | | | 10507c6dc0 cmMakefile: Add configurations getter with empty configuration default Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3759
| * cmMakefile: Add configurations getter with empty configuration defaultDaniel Eiband2019-08-301-20/+8
| |
* | cmSourceFile: Rename mutating GetFullPath() overloadDaniel Eiband2019-08-291-9/+9
|/ | | | Rename mutating GetFullPath() overload to ResolveFullPath().
* Merge topic 'precompile-headers'Brad King2019-08-291-0/+153
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 8da78d4efe Precompile headers: Update documentation 5772930164 Precompile headers: Add unit tests 519606704e Precompile headers: Add support for Visual Studio generators 28be170fbc Precompile headers: Add support for Xcode generator b8626261e9 Precompile headers: Add methods to generate PCH sources 375d01c680 PCH: add example/test 9b6797e71d PCH: add target_precompile_headers command 0467a2f91b PCH: add PRECOMPILE_HEADERS to special properties Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Daniel Pfeifer <daniel@pfeifer-mail.de> Acked-by: Ivan171 <heavenandhell171@gmail.com> Acked-by: Stanislav Ershov <digital.stream.of.mind@gmail.com> Acked-by: Steve Mokris <smokris@softpixel.com> Acked-by: Evgeniy Dushistov <dushistov@mail.ru> Acked-by: Danila Malyutin <flashmozzg@gmail.com> Acked-by: Viktor Kirilov <vik.kirilov@gmail.com> Acked-by: Lucas Zhao <zhaopf6@163.com> Merge-request: !3553
| * Precompile headers: Add methods to generate PCH sourcesCristian Adam2019-08-281-0/+110
| | | | | | | | Co-Author: Daniel Pfeifer <daniel@pfeifer-mail.de>
| * PCH: add PRECOMPILE_HEADERS to special propertiesDaniel Pfeifer2019-08-261-0/+43
| |
* | cmSourceFile: Rename non-const GetLanguageTushar Maheshwari2019-08-271-2/+2
|/ | | | | | | | GetOrDetermineLanguage: - Read the property if available - Determine the Language using the file extension Fix all usage of the non-const member in the repository.
* Merge topic 'source_sweep_ostringstream_single'Brad King2019-08-261-4/+3
|\ | | | | | | | | | | | | 3b2b02825d Source sweep: Replace std::ostringstream when used with a single append Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3726
| * Source sweep: Replace std::ostringstream when used with a single appendSebastian Holtermann2019-08-231-4/+3
| | | | | | | | | | | | | | This replaces `std::ostringstream`, when it is written to only once. If the single written argument was numeric, `std::to_string` is used instead. Otherwise, the single written argument is used directly instead of the `std::ostringstream::str()` invocation.
* | Source sweep: Replace cmExpandList with the shorter cmExpandedListSebastian Holtermann2019-08-231-22/+11
|/ | | | | | | | | | | | This replaces the code pattern ``` std::vector<std::string> args; cmExpandList(valueStr, args, ...) ``` with ``` std::vector<std::string> args = cmExpandedList(valueStr, ...) ```
* Source sweep: Use cmStrCat for string concatenationSebastian Holtermann2019-08-221-107/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 'isolate-declarations'Brad King2019-08-221-2/+6
|\ | | | | | | | | | | | | d331021255 clang-tidy: isolate declarations for readability Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3704
| * clang-tidy: isolate declarations for readabilityRegina Pfeifer2019-08-201-2/+6
| |
* | Merge topic 'cm-contains'Brad King2019-08-211-27/+15
|\ \ | |/ |/| | | | | | | | | | | | | 2dfc52675c cmAlgorithms: Add cmContains Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Sebastian Holtermann <sebholt@web.de> Acked-by: Daniel Pfeifer <daniel@pfeifer-mail.de> Merge-request: !3700
| * cmAlgorithms: Add cmContainsRegina Pfeifer2019-08-191-27/+15
| | | | | | | | Also, use the new function where applicable.
* | Merge topic 'string-literal-append'Brad King2019-08-191-2/+1
|\ \ | | | | | | | | | | | | | | | | | | da26b3be89 avoid adding multiple consecutive string literals to std::string Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3698
| * | avoid adding multiple consecutive string literals to std::stringRolf Eike Beer2019-08-181-2/+1
| |/ | | | | | | While at it change some single character additions to be of type char.
* | Source sweep: Use cmIsOn instead of cmSystemTools::IsOnSebastian Holtermann2019-08-171-8/+8
|/ | | | | | | | | This replaces invocations of - `cmSystemTools::IsInternallyOn` with `cmIsInternallyOn` - `cmSystemTools::IsNOTFOUND` with `cmIsNOTFOUND` - `cmSystemTools::IsOn` with `cmIsOn` - `cmSystemTools::IsOff` with `cmIsOff`
* Source code: Use cmExpandList instead of cmSystemTools::ExpandListArgumentSebastian Holtermann2019-08-141-52/+45
|
* Refactor: Convert all instances of CMAKE_BUILD_WITH_CMAKE to CMAKE_BOOTSTRAPKitware Robot2019-08-091-1/+1
|
* Merge topic 'cmStringAlgorithms_move_functions'Brad King2019-08-071-2/+1
|\ | | | | | | | | | | | | | | 959b97a27f Tests: testStringAlgorithms: Add cmTrimWhitespace, cmEscapeQuotes, cmTokenize 7fbcc16dcd cmStringAlgorithms: cmIsSpace, cmTrimWhitespace, cmEscapeQuotes, cmTokenize Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3647
| * cmStringAlgorithms: cmIsSpace, cmTrimWhitespace, cmEscapeQuotes, cmTokenizeSebastian Holtermann2019-08-051-2/+1
| | | | | | | | | | | | | | | | | | | | This adds the following functions to `cmStringAlgorithms`: - `cmIsSpace` - `cmTrimWhitespace` (moved from `cmSystemTools::TrimWhitespace`) - `cmEscapeQuotes` (moved from `cmSystemTools::EscapeQuotes`) - `cmTokenize` (moved from `cmSystemTools::tokenize` and adapted to accept `cm::string_view`)
* | Fix rpath-link for shared lib with only private depsBrad King2019-08-021-1/+1
| | | | | | | | | | | | | | | | | | Under CMP0022 NEW behavior, the link interface is explicit even if there are no public dependencies (`INTERFACE_LINK_LIBRARIES` is not set). Mark it as such to activate our tracking of private runtime dependencies of shared libraries for generation of `-rpath-link` flags. Fixes: #19556
* | cmGeneratorTarget: Use local var to de-duplicate CMP0022 checksBrad King2019-08-021-4/+4
| |
* | cmLinkItem: Simplify tracking of whether link interface is explicitBrad King2019-08-021-2/+2
|/ | | | We now only need a boolean.
* Cleanups: Use cmHas{Prefix,Suffix} instead of String{Starts,Ends}WithSebastian Holtermann2019-08-011-1/+1
|
* cmStringAlgorithms: Move string functions to the new cmStringAlgorithms.hSebastian Holtermann2019-07-291-0/+1
| | | | | This adds the `cmStringAlgorithms.h` header and moves all string functions from `cmAlgorithms.h` to `cmStringAlgorithms.h`.
* Genex: Memoize usage requirement TARGET_PROPERTY existenceBrad King2019-07-231-0/+47
| | | | | | | | | | | | | | | 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 build setting TARGET_PROPERTY evaluationBrad King2019-07-231-14/+8
| | | | | | | | | | | | | | | For each build setting property (such as `COMPILE_DEFINITIONS` or `INCLUDE_DIRECTORIES`), the value of `$<TARGET_PROPERTY:target,prop>` includes the values of the corresponding `INTERFACE_*` usage requirement 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 using the dedicated evaluation method `cmGeneratorTarget::EvaluateInterfaceProperty`. Issue: #18964, #18965
* Genex: Optimize usage requirement TARGET_PROPERTY recursionBrad King2019-07-231-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* cmGeneratorTarget: Refactor usage requirement genex evaluationBrad King2019-07-191-270/+209
| | | | | | | | | Evaluate usage requirement generator expressions fully before entering the processing loops. This allows us to evaluate and collect all entries up front and then have only one call to the loop over them. This also allows `AddInterfaceEntries` to immediately evaluate the generator expressions it synthesizes, which will enable later optimization.
* cmGeneratorTarget: Move static functions to anonymous namespaceBrad King2019-07-191-26/+43
|
* cmGeneratorTarget: Order usage requirement processing logic consistentlyBrad King2019-07-191-10/+11
| | | | | Re-order logic in all `process*` methods so that they all evaluate generator expressions at the beginning of their loops.
* cmGeneratorTarget: Remove unnecessary copy to local variableBrad King2019-07-191-4/+3
|
* cmGeneratorTarget: Remove unused member of internal classBrad King2019-07-191-3/+0
|
* AIX: Create import library for executables with exportsBrad King2019-07-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On AIX, plugins meant to be loaded into executables via `dlopen` must be linked with access to a list of symbols exported from the executable in order to use them (when not using runtime linking). The AIX linker supports specifying this list as an "import file" passed on the command line either via the `-bI:...` option or (with a leading `#! .` line) as a normal input file like any other library file. The linker import file plays the same role on AIX as import libraries do on Windows. Teach CMake to enable its import library abstraction on AIX for executables with the `ENABLE_EXPORTS` target property set. Teach our internal `ExportImportList` script to optionally generate a leading `#! .` line at the top of the generated export/import list. Update our rule for linking an executable with exports to generate a public-facing "import library" implemented as an AIX linker import file. With this approach, our existing infrastructure for handling import libraries on Windows will now work for AIX linker import files too: * Plugins that link to their executable's symbols will be automatically linked using the import file on the command line. * The executable's import file will be (optionally) installed and exported for use in linking externally-built plugins. This will allow executables and their plugins to build even if we later turn off runtime linking. Issue: #19163
* AIX: Explicitly compute executable exports for both XL and GNUBrad King2019-07-151-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | On AIX, symbols in executables must be exported in order to be visible to modules (plugins) they load via `dlopen`. Prior to policy `CMP0065`, CMake linked all executables with flags to export symbols, but the NEW behavior for that policy is to do so only for executables that have the `ENABLE_EXPORTS` target property set. In both cases, CMake has always used the AIX linker option `-bexpall` option to export symbols from executables. This has worked fairly well with the XL compiler, but with the GNU compiler it works only for C ABI symbols. The reason is that `-bexpall` does not export symbols starting in `_` but the GNU C++ ABI mangles all symbols with a leading `_`. Therefore we have only supported C ABI plugins with the GNU compiler on AIX. Some projects have tried to work around this by replacing `-bexpall` with `-bexpfull`, but the latter often exports symbols that we do not want exported. Avoid using `-bexpall` for executables by instead using by our own internal `ExportImportList` script to compute symbol export lists from the object files to be linked into an executable. Pass the explicitly computed export list to the AIX linker's `-bE:...` option. We already do this for shared object exports. Issue: #19163
* De-duplicate checks for whether a platform uses Windows DLLsBrad King2019-07-121-4/+1
|
* Refactor checks for whether a target has an import libraryBrad King2019-07-121-12/+21
| | | | Use `HasImportLibrary` for such checks.
* IWYU: Fix handling of <memory> standard headerBrad King2019-07-101-1/+1
| | | | | | | | An old workaround for `std::allocator_traits<>::value_type` lints from IWYU on `std::vector<>` usage breaks IWYU's handling of `<memory>`. Convert the workaround to use the same approach we already use for a workaround of `std::__decay_and_strip<>::::__type` lints. Then update the `<memory>` inclusions to follow the now-correct IWYU lints.
* BUILD_RPATH/INSTALL_RPATH: Add generator expression supportKyle Edwards2019-06-251-5/+34
| | | | Fixes: #19423