summaryrefslogtreecommitdiffstats
path: root/Source/cmAlgorithms.h
Commit message (Collapse)AuthorAgeFilesLines
* cmList: CMake list implementationMarc Chevrier2023-04-051-1/+1
| | | | Fixes: #24548
* Merge topic 'mocmacrosonce'Brad King2021-09-091-1/+7
|\ | | | | | | | | | | | | | | | | 8ff0c2b1dd AutoMoc: Do not list moc macros multiple times 6e2f4029c0 cmAlgorithms: Preserve const-ness in cmRemoveDuplicates range signature Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !6459
| * cmAlgorithms: Preserve const-ness in cmRemoveDuplicates range signatureBrad King2021-09-031-1/+7
| | | | | | | | | | | | | | | | The pattern `vec.erase(cmRemoveDuplicates(vec), vec.end())` fails to compile with GCC 4.8's libstdc++ if `cmRemoveDuplicates` returns a `const_iterator` because `end()` returns an `iterator`. Overload `cmRemoveDuplicates` to return an iterator type matching the const-ness of its argument.
* | Refactor: Convert parallel string/backtrace vectors to BT vectorsKyle Edwards2021-09-031-0/+4
|/
* Code style: add missed explicit 'this->'Oleksandr Koval2021-01-051-1/+2
| | | | | CMake uses explicit 'this->' style. Using custom clang-tidy check we can detect and fix places where 'this->' was missed.
* 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.
* Refactoring: Third-parties public headers are under cm3p prefixMarc Chevrier2020-05-071-2/+0
| | | | Fixes: #20666
* Refactoring: add cm::contains to <cmext/algorithm>Marc Chevrier2020-04-171-39/+3
|
* cmAlgorithms: Fix -Wnon-c-typedef-for-linkage warningsRaul Tambre2020-03-091-2/+2
| | | | | | | | | In commit bf1e73305a (cmAlgorithms: Refactor cmRemoveDuplicates, 2019-03-03, v3.15.0-rc1~414^2) we added `union X = struct {}`. C++ had a rule change whereby only C-compatible unnamed typedefs are allowed. Clang 11 warns about this by default. See https://reviews.llvm.org/D74103. The aliases don't seem to be necessary, so simply define as structs.
* cmAlgorithms.h: remove obsolete helpersMarc Chevrier2020-01-141-41/+0
|
* Refactoring: suppress cmEraseIf in favor of cm::erase_ifMarc Chevrier2020-01-091-6/+0
|
* Refactoring: use append functions from cmext/algorithmMarc Chevrier2019-12-171-27/+0
|
* cmGeneratorExpressionEvaluator: Modernize memory managementMarc Chevrier2019-12-051-0/+8
|
* cmAlgorithm: Extend cmAppend capabilitiesMarc Chevrier2019-11-111-0/+8
|
* Revise include order using clang-format-6.0Kitware Robot2019-10-011-2/+4
| | | | | 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.
* cmstd: Modernize CMake system headersMarc Chevrier2019-09-201-77/+0
| | | | | | | | | | | | | | Provide a standardized way to handle the C++ "standard" headers customized to be used with current CMake C++ standard constraints. Offer under directory `cm` headers which can be used as direct replacements of the standard ones. For example: #include <cm/string_view> can be used safely for CMake development in place of the `<string_view>` standard header. Fixes: #19491
* 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.
* clang-tidy: Replace typedef with usingRegina Pfeifer2019-09-031-3/+3
|
* cmAlgorithms: Add cmContainsRegina Pfeifer2019-08-191-1/+39
| | | | Also, use the new function where applicable.
* cmStringAlgorithms: Move string functions to the new cmStringAlgorithms.hSebastian Holtermann2019-07-291-126/+0
| | | | | This adds the `cmStringAlgorithms.h` header and moves all string functions from `cmAlgorithms.h` to `cmStringAlgorithms.h`.
* cmAlgorithms: Make cmHasLiteral{Prefix,Suffix} cm::string_view basedSebastian Holtermann2019-07-241-38/+14
|
* cmAlgorithms: Make cmHasPrefix and cmHasSuffix cm::string_view basedSebastian Holtermann2019-07-221-9/+28
| | | | | | | | | Make `cmHasPrefix`, `cmHasSuffix` and `cmStripSuffixIfExists` accept arguments as `cm::string_view` instead of `const std::string&`. This lets them accept literal strings without having to allocate a temporary `std::string`. Add variants of `cmHasPrefix`, `cmHasSuffix` and `cmStripSuffixIfExists` that accept a single character as second argument.
* Introduce memory management helper: cm_memory.hxxMarc Chevrier2019-07-141-15/+0
|
* cmAlgorithms: Add cmAppend functionSebastian Holtermann2019-05-231-0/+12
| | | | | The new `cmAppend` function simplifies appending ranges of values to a `std::vector`.
* cmAlgorithms: Refactor cmRemoveDuplicatesArtur Ryt2019-03-061-18/+36
| | | | | | | | Use an iterator-based implementation with range-based one simply deferring to it. Also optimize a little by storing iterators to unique values to prevent creating value copies.
* cmRange: Move to dedicated header fileRegina Pfeifer2019-02-211-65/+2
|
* Merge topic 'fix-legacy-implicit-includes'Brad King2019-02-141-0/+8
|\ | | | | | | | | | | | | | | | | | | 6fc3382944 Update logic for sysroot in detected implicit include directories 2ad14ef4ea cmAlgorithms: Add cmHasPrefix to match existing cmHasSuffix 557b2d6e65 Fix regression in -I/usr/include exclusion logic 017598a444 macOS: Fix addition of <sdk>/usr/include to default implicit include dirs Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2957
| * cmAlgorithms: Add cmHasPrefix to match existing cmHasSuffixBrad King2019-02-131-0/+8
| |
* | cmAlgorithms: Make cmRange advance/retreat safe for rvaluesArtur Ryt2019-02-071-3/+15
|/ | | | | | | In rvalue context these functions have to return cmRange by copy instead of reference to temporary object It allows to use ranged-for over cmMakeRange(xxx).advance(yyy)
* clang-tidy: Pass by valueRegina Pfeifer2019-01-221-2/+2
|
* cmAlgorithms: add utility functions to get signed size of containersBruno Manganelli2018-12-271-0/+6
|
* Revise C++ coding style using clang-format-6.0Kitware Robot2018-06-011-10/+10
| | | | | | | | | | | | 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.
* cmAlgorithms: Speed up cmRemoveDuplicates methodLe Minh Phuc2018-05-251-41/+6
| | | | | | Use a hash table instead of a sorted vector to track entries. Co-authored-by: Chu Qinghao <me@qinghao1.com>
* cmAlgorithms: Remove unnecessary typename keywordjrp20142018-04-051-1/+1
|
* Replace cmArray{Begin,End,Size} by their standard counterpartsMatthias Maennich2017-10-231-16/+61
| | | | | | | | | | | std::{begin,end} are part of C++11, std::{cbegin,cend} are part of C++14 and an standard compliant implementation has been introduced within the 'cm' namespace: cm::{cbegin,cend}. std::size is only part of C++17, hence exposing a compliant implementation within namespace cm (cm::size). where possible, the standard implementations are reused.
* Avoid using std::bind1st that is removed in C++17Brad King2017-09-231-2/+1
| | | | Use a lambda instead now that we require C++11.
* clang-format: format all code as Cpp11Daniel Pfeifer2017-08-301-1/+1
|
* server: backport to C++11Daniel Pfeifer2017-08-261-0/+19
|
* cmAlgorithms: pass std::string by const refDaniel Pfeifer2017-04-211-1/+2
|
* Use quotes for non-system includesDaniel Pfeifer2017-04-111-2/+2
| | | | | | | | | | | | | 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'
* cmAlgorithms: add cmEraseIf functionDaniel Pfeifer2017-02-101-0/+6
|
* clang-tidy: apply performance-unnecessary-value-param fixesDaniel Pfeifer2016-12-121-4/+4
|
* Fix several include-what-you-use findingsDaniel Pfeifer2016-11-081-3/+11
|
* 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.
* make sure to include cmConfigure.h before cmStandardIncludes.hDaniel Pfeifer2016-09-031-0/+2
|
* Ninja: Support embedding of CMake as subninja projectNicolas Despres2016-05-171-0/+15
| | | | | | Add a `CMAKE_NINJA_OUTPUT_PATH_PREFIX` variable. When it is set, CMake generates a `build.ninja` file suitable for embedding into another ninja project potentially generated by an alien generator.
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-103/+113
| | | | | | | | | | | | | 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.
* cmAlgorithms.h: remove superfluous semicolon after methodChristoph GrĂ¼ninger2016-02-011-1/+1
|
* Remove temporary allocations when calling cmHasLiteral{Suf,Pre}fix.Milian Wolff2016-01-201-2/+2
| | | | | | | | | When the first argument passed is a std::string, we need to take it by const&, otherwise we copy the string and trigger a temporary allocation. This patch removes a few 10k temporary allocations when running the CMake daemon on the KDevelop build dir. This hotspot was found with heaptrack.
* Port CMake from cmIML to KWIMLBrad King2015-12-181-2/+2
| | | | KWIML no longer uses a configured prefix.