summaryrefslogtreecommitdiffstats
path: root/Source/cmFindPackageCommand.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Revise C++ coding style using clang-format-6.0Kitware Robot2018-06-011-19/+24
| | | | | | | | | | | | 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.
* Help: Add 'lib32|libx32|lib64' paths to find_package prefixesRuslan Baratov2018-03-211-6/+6
| | | | | Document the conditions when 'lib32|libx32|lib64' variants will be added to the list of possible installation prefixes.
* find_package: Use PackageName_ROOT variables as search prefixesBrad King2018-03-161-16/+42
| | | | | | | | | | | | | | | | | | | This feature was originally added by commit v3.9.0-rc1~71^2~2 (find_*: Add a new PackageRoot search path group, 2017-05-03) and documented by commit v3.9.0-rc1~71^2 (find_*: Add docs for PackageRoot search path group, 2017-05-03). However, we had to disable the feature and remove the documentation in commit v3.9.1~2^2 (find_*: Disable the PACKAGE_ROOT search path group for CMake 3.9, 2017-08-08) due to breaking projects that used `PackageName_ROOT` variables themselves. Add policy `CMP0074` to restore the `PackageName_ROOT` variable behavior in a compatible way. Also revise the stack of root paths to store the paths themselves rather than the package names. This way the policy can be considered at the `find_package` call site instead of individual `find_` calls inside a find module. Co-Author: Chuck Atkins <chuck.atkins@kitware.com> Issue: #17144
* Reduce raw string pointers usage.Pavel Solodovnikov2018-01-311-7/+6
| | | | | | | | | | * Change some functions to take `std::string` instead of `const char*` in the following classes: `cmMakeFile`, `cmake`, `cmCoreTryCompile`, `cmSystemTools`, `cmState`, `cmLocalGenerator` and a few others. * Greatly reduce using of `const char*` overloads for `cmSystemTools::MakeDirectory` and `cmSystemTools::RelativePath`. * Remove many redundant `c_str()` conversions throughout the code.
* Reduce allocation of temporary values on heap.Pavel Solodovnikov2018-01-261-3/+3
| | | | | - Use `std::move` while inserting temporary results into vectors. - Change `push_back` to `emplace_back` where appropriate.
* Fix trivial typos in textluzpaz2017-11-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Some are user facing. Found using codespell -q 3 --skip="./Utilities" -I .cmake-whitelist.txt` whereby the whitelist contained: ans dum helpfull emmited emmitted buil iff isnt nto ot pathes substract te todays upto whitespaces
* Retire std::auto_ptr and its macro CM_AUTO_PTRMatthias Maennich2017-09-251-19/+18
| | | | Signed-off-by: Matthias Maennich <matthias@maennich.net>
* Use C++11 override instead of CM_OVERRIDEBrad King2017-09-151-13/+13
| | | | | | | | We now require C++11 support including `override`. Drop use of the old compatibility macro. Convert references as follows: git grep -l CM_OVERRIDE -- '*.h' '*.hxx' '*.cxx' | xargs sed -i 's/CM_OVERRIDE/override/g'
* Meta: modernize old-fashioned loops to range-based `for`.Pavel Solodovnikov2017-09-121-74/+47
| | | | | | Changes done via `clang-tidy` with some manual fine-tuning for the variable naming and `auto` type deduction where appropriate.
* Use C++11 nullptrDaniel Pfeifer2017-08-241-2/+2
|
* find_*: Disable the PACKAGE_ROOT search path group for CMake 3.9Brad King2017-08-081-0/+2
| | | | | | | | | | | | | | | | Disable the feature added by commit v3.9.0-rc1~71^2~2 (find_*: Add a new PackageRoot search path group, 2017-05-03) and remove documentation added by commit v3.9.0-rc1~71^2 (find_*: Add docs for PackageRoot search path group, 2017-05-03). Unfortunately the name `<pkg>_ROOT` may already be set by projects for their own incompatible purposes. Disable the behavior change for now to fix the regression for CMake 3.9. We can restore it later with a policy. In order to keep the implementation and tests working, add an undocumented variable we can use in the tests to enable the behavior before the policy is introduced. Fixes: #17144
* find_package: Add missing PACKAGE_ROOT_PATH search path implementation.Chuck Atkins2017-07-281-0/+20
|
* find_package: Restore longer message when config files were consideredBrad King2017-07-071-1/+2
| | | | | | | | | | | | | | | | | | Since commit v3.9.0-rc1~58^2 (find_package: shorten output for missing package in config mode, 2017-05-09) we print only the one line - Could NOT find Foo (missing: Foo_DIR) when package Foo cannot be found in CONFIG mode and it is not REQUIRED. However, in the case that package configuration files were found but not used, this one line message leaves out important information. This can happen when a package configuration file sets `Foo_FOUND` to `FALSE` or when its package version file does not match the requested version. Restore the longer message in these cases. Otherwise a seemingly valid explicit `Foo_DIR` setting appears to be silently ignored even if it was considered. Fixes: #17029
* Provide and use CM_FALLTHROUGHDaniel Pfeifer2017-06-031-8/+16
|
* Access string npos without instancePavel Solodovnikov2017-06-011-1/+2
|
* Merge topic 'reduce-string-copying'Brad King2017-05-281-3/+3
|\ | | | | | | | | | | | | | | | | | | | | 2c2bb5f5 Remove unnecessary operator<< usage 1e4e2f99 Remove unused variables 25486156 Improved checking for number of arguments passed 86dc86dd Add const-reference qualifications 76bdb407 Change std::basic_string<char> to std::string Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !886
| * Add const-reference qualificationsPavel Solodovnikov2017-05-261-3/+3
| |
* | Merge topic 'find_package-shorter-message'Brad King2017-05-251-90/+104
|\ \ | |/ |/| | | | | | | | | | | d0b9d1cc find_package: shorten output for missing package in config mode d9df805f cmFindPackageCommand: Split condition to improve readability Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !851
| * find_package: shorten output for missing package in config modeChristoph Grüninger2017-05-231-2/+10
| | | | | | | | | | | | | | If CONFIG or MODULE is given and the package is not REQUIRED, output a one-liner instead of the full warning. Update Tests/RunCMake/find_package expected output to match.
| * cmFindPackageCommand: Split condition to improve readabilityChristoph Grüninger2017-05-231-91/+97
| |
* | find_*: Add a new PackageRoot search path groupChuck Atkins2017-05-161-0/+7
|/ | | | | | The new PackageRoot search path group allows the PackageName_ROOT cmake and environment variables to be used as search prefixes for all find_* commands called from within a find module
* Use quotes for non-system includesDaniel Pfeifer2017-04-111-6/+6
| | | | | | | | | | | | | 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'
* fix include order of windows.hDaniel Pfeifer2017-03-141-1/+0
| | | | | | Comments that indicate a special include order is necessary because GetCurrentDirectory might get redefined are outdated. Remove those outdated comments and use the normal ordering of includes.
* Add support for x32-abiSteven Newbury2017-03-071-0/+11
| | | | | | | | Detect x32-abi through CMakeCompilerABI infrastruture and use this information at runtime to determine the correct library paths with `FIND_LIBRARY_USE_LIBX32_PATHS`. Fixes: #15994
* Include necessary headers in commandsDaniel Pfeifer2016-10-261-14/+21
|
* Fix newly discovered clang-tidy issuesDaniel Pfeifer2016-10-211-9/+7
| | | | | | | Clang-tidy reports some issues only from the currently compiled source file and its associated header file. Separating the compilation of commands exposed some clang-tidy issues that were not reported previously. Fix them.
* Separate compilation for commands included in cmBootstrapCommands1Daniel Pfeifer2016-10-211-0/+3
|
* cmListFileCache: Remove cmState header includeStephen Kelly2016-10-191-0/+1
| | | | | Include it in dependents which have previously relied on it transitively.
* cmState: Move CacheEntryType enum to separate namespaceStephen Kelly2016-10-191-1/+1
| | | | Port dependent code to the change.
* 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.
* Avoid else after returnDaniel Pfeifer2016-09-161-14/+10
|
* Merge topic 'size-empty'Brad King2016-09-161-1/+1
|\ | | | | | | | | 73f648f1 use empty method to check for emptyness
| * use empty method to check for emptynessDaniel Pfeifer2016-09-151-1/+1
| |
* | find_package: Optionally sort globbed directories in a meaningful orderPierluigi Taddei2016-09-151-13/+105
|/ | | | | | | | | | | | Add `CMAKE_FIND_PACKAGE_SORT_{ORDER,DIRECTION}` variables to specify sort order and direction. When multiple package with the same name have been found in the same location sorting option can be used to force a specific version to be loaded (e.g. libA_1.12.0 instead of libA_1.1.0). Currently sorting by NAME and by NATURAL order have been implemented. Natural ordering makes use of the `strverscmp(3)` ordering.
* find_package: Extend search path for combined Windows/UNIX conventionSilvio Traversaro2016-08-241-0/+38
| | | | | | | | Find packages that install their cmake package configuration files in `lib/cmake/<name>` when they are installed in the default Windows CMAKE_INSTALL_PREFIX, `C:/Program Files/<name>`. Closes: #16212
* Use better KWSys SystemTools::GetEnv and HasEnv signaturesDāvis Mosāns2016-07-181-2/+2
|
* Avoid using KWSys auto_ptr by adopting it ourselvesBrad King2016-06-291-17/+16
| | | | | | | | | | | | Replace use of cmsys::auto_ptr with a CM_AUTO_PTR macro that maps to our own implementation adopted from the KWSys auto_ptr implementation. Later we may be able to map CM_AUTO_PTR to std::auto_ptr on compilers that do not warn about it. Automate the client site conversions: git grep -l auto_ptr -- Source/ | grep -v Source/kwsys/ | xargs sed -i \ 's|cmsys::auto_ptr|CM_AUTO_PTR|;s|cmsys/auto_ptr.hxx|cm_auto_ptr.hxx|'
* use CM_NULLPTRDaniel Pfeifer2016-06-281-2/+2
|
* mark functions with CM_OVERRIDEDaniel Pfeifer2016-06-271-13/+13
|
* Merge topic 'find_package-duplicate-search-paths'Brad King2016-06-161-8/+11
|\ | | | | | | | | | | 919db25c cmFindPackageCommand: remove duplicate paths from error message ebf18df5 cmFindPackageCommand: use iterators to loop over configurations
| * cmFindPackageCommand: remove duplicate paths from error messageBen Boeckel2016-06-131-1/+3
| | | | | | | | Fixes #15252.
| * cmFindPackageCommand: use iterators to loop over configurationsBen Boeckel2016-06-131-8/+9
| |
* | Teach find_library and find_package to search lib32 paths (#11260)Daniel Scharrer2016-06-101-0/+11
|/ | | | | | | Add a ``FIND_LIBRARY_USE_LIB32_PATHS`` global property analogous to the ``FIND_LIBRARY_USE_LIB64_PATHS`` property. This helps find commands on multilib systems that use ``lib32`` directories and either do not have ``lib`` symlinks or point ``lib`` to ``lib64``.
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-962/+776
| | | | | | | | | | | | | 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.
* Remove `//------...` horizontal separator commentsBrad King2016-05-091-41/+0
| | | | | | | | | | | | | | | | | | | | | | | | Modern editors provide plenty of ways to visually separate functions. Drop the explicit comments that previously served this purpose. Use the following command to automate the change: $ git ls-files -z -- \ "*.c" "*.cc" "*.cpp" "*.cxx" "*.h" "*.hh" "*.hpp" "*.hxx" | egrep -z -v "^Source/cmCommandArgumentLexer\." | egrep -z -v "^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmDependsJavaLexer\." | egrep -z -v "^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmExprLexer\." | egrep -z -v "^Source/cmExprParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmFortranLexer\." | egrep -z -v "^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmListFileLexer\." | egrep -z -v "^Source/cm_sha2" | egrep -z -v "^Source/(kwsys|CursesDialog/form)/" | egrep -z -v "^Utilities/(KW|cm).*/" | xargs -0 sed -i '/^\(\/\/---*\|\/\*---*\*\/\)$/ {d;}' This avoids modifying third-party sources and generated sources.
* Isolate formatted streaming blocks with clang-format off/onBrad King2016-05-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The clang-format tool can do a good job formatting most code, but well-organized streaming blocks are best left manually formatted. Find blocks of the form os << "...\n" "...\n" ; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *("[^\n]*("|<<|;)$|;)\n){2,}' Find blocks of the form os << "...\n" << "...\n" << "...\n"; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *<<[^\n]*(\\n"|<<|;)$\n){2,}' Surround such blocks with the pair /* clang-format off */ ... /* clang-format on */ in order to protect them from update by clang-format. Use the C-style `/*...*/` comments instead of C++-style `//...` comments in order to prevent them from ever being swallowed by re-formatting of surrounding comments.
* Format include directive blocks and ordering with clang-formatBrad King2016-04-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Merge branch 'fix-bad-search-ordering' into test-search-orderingBrad King2015-09-151-1/+4
|\
| * find_*: Fix search order when the environment duplicates some HINTSChuck Atkins2015-09-141-1/+4
| | | | | | | | | | | | | | | | | | Refactoring in the topic merged by commit v3.2.0-rc1~400 (Merge topic 'refactor-search-path-construction', 2014-11-13) introduced a bug that filters out duplicate paths in an incorrect order. Restore the search path to its documented order even when duplicate paths are present. Reported-by: Marc CHEVRIER <marc.chevrier@sap.com>
* | Remove use of include <cmsys/ios/*> and cmsys_ios::*Brad King2015-08-201-1/+1
|/ | | | We no longer need this compatibility layer for the compilers we support.