summaryrefslogtreecommitdiffstats
path: root/Source/cmFindPackageCommand.cxx
Commit message (Collapse)AuthorAgeFilesLines
* find_package: Add variable to make package REQUIREDEugene Shalygin2021-07-081-3/+21
| | | | | | | | | | | | | | Add a `CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>` variable is complement to `CMAKE_DISABLE_FIND_PACKAGE_<PackageName>` with just the opposite behaviour: it turns non-required find_package call into the required one. While optional package dependencies usually result in simple and clean build logic, sometimes people want to be sure those optional dependencies will be found and used. Examples are reproducible builds and build instructions for 3rd parties. People choose to make find_package calls REQUIRED and put them behind an option(). Such workarounds blend build logic with build environment management and do not look elegant.
* set(CACHE): do not remove normal variableMarc Chevrier2021-05-201-0/+5
| | | | Fixes: #22038
* clang-tidy: fix `readability-use-anyofallof` warningsBen Boeckel2021-01-271-18/+11
|
* Code style: add missed explicit 'this->'Oleksandr Koval2021-01-051-6/+6
| | | | | CMake uses explicit 'this->' style. Using custom clang-tidy check we can detect and fix places where 'this->' was missed.
* find_package: Fix regression in searching root prefixBrad King2020-10-191-1/+1
| | | | | | | | Fix the check added by commit 2ff1693066 (find_package: avoid showing files as directories when searching config files, 2020-09-30, v3.19.0-rc1~67^2) to avoid skipping the root prefix `/`. Fixes: #21324
* Merge topic 'find_package-check-dir'Brad King2020-10-011-4/+5
|\ | | | | | | | | | | | | 2ff1693066 find_package: avoid showing files as directories when searching config files Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5301
| * find_package: avoid showing files as directories when searching config filessanchayanghosh2020-09-301-4/+5
| | | | | | | | | | | | | | Teach `cmFileListGeneratorBase::Consider` to skip non-directories so that all call sites get the check. Fixes: #21212
* | find_package: raise error on empty version rangeMarc Chevrier2020-09-291-1/+14
|/
* Merge topic 'find_package_module_mode_print_debug_message'Brad King2020-09-251-0/+16
|\ | | | | | | | | | | | | | | b423a20ce1 FindPackage: Provide better debug message when <PKG_FOUND> is false a7acafc977 FindPackage: find_package(MODULE) respects CMAKE_FIND_DEBUG_MODE Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5256
| * FindPackage: Provide better debug message when <PKG_FOUND> is falseRobert Maynard2020-09-221-0/+11
| |
| * FindPackage: find_package(MODULE) respects CMAKE_FIND_DEBUG_MODERobert Maynard2020-09-221-0/+5
| | | | | | | | Fixes #21216
* | find_package: Add support of version rangeMarc Chevier2020-09-231-45/+116
| | | | | | | | This enhancement is the first step for solving issue #21107
* | cmFindPackageCommand: RefactoringMarc Chevrier2020-09-231-73/+57
|/ | | | | | * Use member initialisation at declaration * AddFindDefinition: same signature as cmMakefile::AddDefinition for consistency * Factorise version variables creation
* cmMakefile::GetDefinition: return cmPropVitaly Stakhovsky2020-09-021-17/+17
|
* Merge topic 'cmnonempty'Kyle Edwards2020-07-151-2/+2
|\ | | | | | | | | | | | | eaad8072ee cmNonempty: Convenience inlines to check for non-empty string Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5017
| * cmNonempty: Convenience inlines to check for non-empty stringVitaly Stakhovsky2020-07-141-2/+2
| |
* | cmIsOn: add overload accepting const std::string*Vitaly Stakhovsky2020-07-141-3/+3
|/
* Merge topic 'getdef-expand'Brad King2020-06-021-3/+1
|\ | | | | | | | | | | | | 7ed8c9ebe3 cmMakefile: add GetDefExpandList() that splits value into std::vector Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4819
| * cmMakefile: add GetDefExpandList() that splits value into std::vectorVitaly Stakhovsky2020-05-301-3/+1
| | | | | | | | Combines cmMakefile:GetDefinition() and cmExpandList()
* | Single location for cmProp typedefVitaly Stakhovsky2020-06-011-0/+1
|/
* clang-tidy: address bugprone-branch-clone lintsBen Boeckel2020-04-131-0/+6
| | | | | | | | | Arguably, many of these are bugs in `clang-tidy`. An if/else tree with other conditionals between cloned blocks may be relying on the intermediate logic to fall out of the case and inverting this logic may be non-trivial. See: https://bugs.llvm.org/show_bug.cgi?id=44165
* cmState::GetGlobalProperty: return cmPropVitaly Stakhovsky2020-03-251-10/+6
|
* cmMakefile::AddCacheDefinition: Add overload that accepts std::string valueVitaly Stakhovsky2020-03-111-2/+2
|
* find_package: Improve debug logging outputRobert Maynard2020-01-011-12/+34
| | | | | The find_package debug log messages are now easier to read when enabled by the `--debug-find` command-line option or `CMAKE_FIND_DEBUG_MODE` variable.
* find_*: Use debug logging infrastructureRobert Maynard2019-12-191-13/+120
| | | | | | Teach the find_package, find_library, find_program, find_path, and find_file commands to print debug log messages when enabled by the `--debug-find` command-line option or `CMAKE_FIND_DEBUG_MODE` variable.
* find_package: Add support for CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRYRobert Maynard2019-11-041-1/+7
| | | | | | | | Extend the change from commit 1d00ba9ccf (Find: find_package prefers variable CMAKE_FIND_USE_REGISTRY, 2018-11-13, v3.16.0-rc1~461^2~1) to cover the system package registry too. Fixes: #19890
* Revise include order using clang-format-6.0Kitware Robot2019-10-011-6/+7
| | | | | 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-1/+1
| | | | | | | | | | | | | | 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
* Refactor: Use cmStrCat to construct error stringsAsit Dhal2019-09-181-24/+21
| | | | | Replace string construction using std::stringstream with cmStrCat and cmWrap.
* clang-tidy: modernize-deprecated-headersRegina Pfeifer2019-09-161-3/+3
|
* Merge topic 'modernize-use-auto'Brad King2019-09-121-6/+4
|\ | | | | | | | | | | | | d25a5a7ec9 clang-tidy: modernize-use-auto Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3783
| * clang-tidy: modernize-use-autoRegina Pfeifer2019-09-101-6/+4
| | | | | | | | | | | | 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.
* | cmFind*: Port away from cmCommandRegina Pfeifer2019-09-101-3/+9
|/
* Source sweep: Use cmStrCat for string concatenationSebastian Holtermann2019-08-221-79/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)`
* Source sweep: Use cmIsOn instead of cmSystemTools::IsOnSebastian Holtermann2019-08-171-5/+4
| | | | | | | | | 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-3/+3
|
* Merge topic 'find_package-prefer-config-not-found'Brad King2019-08-071-1/+3
|\ | | | | | | | | | | | | 8ed868606d find_package: Fix prefer-config mode to not fail on missing optional package Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3653
| * find_package: Fix prefer-config mode to not fail on missing optional packageCristian Adam2019-08-061-1/+3
| | | | | | | | | | | | | | | | When `CMAKE_FIND_PACKAGE_PREFER_CONFIG` mode was set to `ON`, failure to find a package was fatal even if it was not `REQUIRED`. Fix this and add a test case. Fixes: #19557
* | 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`.
* | Merge topic 'definitions_string_view'Brad King2019-07-261-10/+10
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | e91bfe440c cmMakefile: Let AddDefinition accept a value as cm::string_view f2ba968ef2 cmMakefile: Simplify and rename AddDefinitionBool 9b5cc42531 cmDefinitions: Remove const char* based Set method e268840c0a cmDefinitions: Add Unset and cm::string_view based Set methods 451fd329a8 cmDefinitions: Cleanups Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3577
| * | cmMakefile: Let AddDefinition accept a value as cm::string_viewSebastian Holtermann2019-07-241-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes `cmMakefile::AddDefinition` to take a `cm::string_view` as value argument instead of a `const char *`. Benefits are: - `std::string` can be passed to `cmMakefile::AddDefinition` directly without the `c_str()` plus string length recomputation fallback. - Lengths of literals passed to `cmMakefile::AddDefinition` can be computed at compile time. In various sources uses of `cmMakefile::AddDefinition` are adapted to avoid `std::string::c_str` calls and the `std::string` is passed directly. Uses of `cmMakefile::AddDefinition`, where a `nullptr` `const char*` might be passed to `cmMakefile::AddDefinition` are extended with `nullptr` checks.
* | | FindPackage: Support `NO_[]_PATH` global call optionsRobert Maynard2019-07-221-0/+3
|/ /
* | Merge topic 'find_package-fix-NO_MODULE'Brad King2019-07-171-2/+3
|\ \ | |/ | | | | | | | | | | f2edccea66 find_package: Fix NO_MODULE under CMAKE_FIND_PACKAGE_PREFER_CONFIG Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3557
| * find_package: Fix NO_MODULE under CMAKE_FIND_PACKAGE_PREFER_CONFIGCristian Adam2019-07-161-2/+3
| | | | | | | | | | | | | | | | | | | | | | The module mode fallback added by commit 22e65d10c1 (find_package: Fixed CMAKE_FIND_PACKAGE_PREFER_CONFIG Module fallback, 2019-06-13, v3.15.0-rc2~6^2) should not be used unless the `find_package` call allows module mode. Doing so can lead to infinite recursion if a find module tries to call config mode with `find_package(... NO_MODULE)`. Fix the logic and add a test case. Fixes: #19478
* | Introduce memory management helper: cm_memory.hxxMarc Chevrier2019-07-141-1/+2
| |
* | 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.
* | Merge topic 'add_cmake_find_use_package_registry'Craig Scott2019-07-091-1/+6
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 447a96f590 vim: Update cmake.vim to include the CMAKE_FIND_USE variables 1d00ba9ccf Find: find_package prefers variable CMAKE_FIND_USE_REGISTRY 704e3a2ca8 Find: Correct spelling and layout issues in CMAKE_FIND_USE_ docs Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3487
| * | Find: find_package prefers variable CMAKE_FIND_USE_REGISTRYRobert Maynard2019-07-091-1/+6
| |/ | | | | | | | | | | CMake's find control flags should all have a consistent name. To make this happen we are introducing `CMAKE_FIND_USE_REGISTRY` and deprecating `CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY`.
* | Remove unused variables from cmFindPackageCommandRobert Maynard2019-06-261-6/+0
|/
* find_package: Fixed CMAKE_FIND_PACKAGE_PREFER_CONFIG Module fallbackCristian Adam2019-06-131-4/+16
| | | | Fixes: #19361