summaryrefslogtreecommitdiff
path: root/Source/cmFindProgramCommand.cxx
Commit message (Collapse)AuthorAgeFilesLines
* find_(program,library,file,path): add validation functionMarc Chevrier2022-06-141-6/+6
| | | | Fixes: #23603
* find_* commands: add control over Windows registry viewsMarc Chevrier2022-04-291-0/+14
| | | | Fixes: #22775
* cmake: Add filtered debug-find optionsJohn Parent2021-12-171-1/+2
| | | | | | | | | | Add a `--debug-find-pkg=` option to debug find calls for specific packages. Add a `--debug-find-var=` option to debug find calls for specific return variables. Fixes: #21880
* find_program: Explicitly skip WindowsApps/python*.exe app installer linksBrad King2021-11-011-0/+20
| | | | | | | | | Windows provide a "python" executable like this: %USERPROFILE%\AppData\Local\Microsoft\WindowsApps\python.exe It is actually a Windows app exec link. If it points to an app installer, avoid mistaking it for a working Python.
* find_*: Add support for option NO_CACHEMarc Chevrier2021-06-021-1/+1
| | | | | | | | Request that find result is stored in a normal variable rather than a cache entry. Fixes: #20687 Issue: #20743
* find_*: refactor cache variable handlingMarc Chevrier2021-05-111-32/+13
|
* clang-tidy: fix `readability-use-anyofallof` warningsBen Boeckel2021-01-271-32/+33
|
* Code style: add missed explicit 'this->'Oleksandr Koval2021-01-051-4/+4
| | | | | CMake uses explicit 'this->' style. Using custom clang-tidy check we can detect and fix places where 'this->' was missed.
* find_program: Find programs that are executable but not readableBrad King2020-06-151-1/+47
| | | | | | | | | This fix was first made by commit 86e6349ef7 (find_program: Find programs that are executable but not readable, 2020-04-04, v3.18.0-rc1~372^2) but was reverted for compatibility. Re-introduce it with a policy for compatibility. Fixes: #10468
* Merge topic 'bundle-exe-space-in-name'Brad King2020-06-151-7/+6
|\ | | | | | | | | | | | | d3fd518c03 find_program: Properly decode URL for bundle exe name with spaces Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4891
| * find_program: Properly decode URL for bundle exe name with spacesCraig Scott2020-06-141-7/+6
| | | | | | Fixes: #20817
* | find_program: Revert "Find programs that are executable but not readable"Brad King2020-06-121-1/+1
|/ | | | | | | | | | | | | | The fix in commit 86e6349ef7 (find_program: Find programs that are executable but not readable, 2020-04-04, v3.18.0-rc1~372^2) can break existing projects that were (likely accidentally) relying on the old behavior to find files that are readable but not executable. Revert the fix for now. We can re-introduce it with a policy later. Instead of reverting the test case, update it to cover the old behavior. That can serve as a reference for testing the policy when introduced. Fixes: #20814 Issue: #10468
* find_program: Find programs that are executable but not readableVladimir Menshakov2020-04-091-1/+1
| | | | | | | | | `find_program` internally uses `cmSystemTools::FileExists` which calls `access(R_OK)` instead of `access(X_OK)`. Use `cmSystemTools::IsFileExecutable` instead to fix this issue. An example of such a program is `sudo`. Fixes: #10468
* cmMakefile::AddCacheDefinition: Add overload that accepts std::string valueVitaly Stakhovsky2020-03-111-2/+2
|
* find_*: Add support for REQUIRED keywordSylvain Joubert2020-03-061-0/+8
| | | | | | In the same spirit as the REQUIRED keyword on find_package, this will stop cmake execution with an error on a failed find_program, find_file, find_path or find_library.
* find_*: Use debug logging infrastructureRobert Maynard2019-12-191-5/+14
| | | | | | 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.
* cmFind*: Port away from cmCommandRegina Pfeifer2019-09-101-3/+9
|
* Source sweep: Use cmStrCat for string concatenationSebastian Holtermann2019-08-221-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)`
* Cleanups: Use cmHas{Prefix,Suffix} instead of String{Starts,Ends}WithSebastian Holtermann2019-08-011-1/+2
|
* find_program: Restore leading double slash on Windows network pathBrad King2019-03-141-1/+1
| | | | | | | | | | | | | | Since commit c76c1ea208 (find_program: Consider CWD only for paths with separator, 2018-05-31, v3.13.0-rc1~413^2) we accidentally convert the leading `//` to just `/` on results with Windows network paths. This was caused by `CollapseCombinedPath` being less robust than `CollapseFullPath`. Restore use of the latter but in a way that preserves the requirement of the above commit to support candidates that are themselves absolute. Fixes: #19049 Issue: #19050
* find_program: Consider CWD only for paths with separatorSam Yates2018-06-141-8/+26
| | | | | | | | | | | | | | | | | | find_program() incorrectly prepended search path components to absolute file paths, and incorrectly searched the current working directory for files that contained no directory separators. * Replace calls cmFindProgramHelper::CheckDirectory(std::string()) with call of new method cmFindProgramHelper::CheckCompoundNames() that checks for the presence of a directory separator in the file name. * Use cmSystemTools::CollapseCombinedPath rather than string concatenation to properly combine absolute file names with search path components. * Add unit tests to verify corrections. Fixes: #18044
* Revise C++ coding style using clang-format-6.0Kitware Robot2018-06-011-1/+1
| | | | | | | | | | | | 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.
* Reduce allocation of temporary values on heap.Pavel Solodovnikov2018-01-261-1/+1
| | | | | - Use `std::move` while inserting temporary results into vectors. - Change `push_back` to `emplace_back` where appropriate.
* Replace empty-string comparisons with checking against `empty()`.Pavel Solodovnikov2017-09-211-2/+2
|
* Use C++11 nullptr (cont.)Matthias Maennich2017-09-191-1/+1
| | | | | | | Fix remaining occurrences of the issue addressed in commit 5962db4389 (Use C++11 nullptr, 2017-08-22) that are only showing up on macOS. Signed-off-by: Matthias Maennich <matthias@maennich.net>
* Meta: modernize old-fashioned loops to range-based `for`.Pavel Solodovnikov2017-09-121-23/+15
| | | | | | Changes done via `clang-tidy` with some manual fine-tuning for the variable naming and `auto` type deduction where appropriate.
* Pass large types by const&, small types by valueDaniel Pfeifer2017-06-041-1/+2
|
* clang-tidy: apply readability-redundant-string-init fixesDaniel Pfeifer2016-12-121-2/+2
|
* Include necessary headers in commandsDaniel Pfeifer2016-10-261-1/+3
|
* Separate compilation for commands included in cmBootstrapCommands1Daniel Pfeifer2016-10-211-0/+2
|
* cmState: Move CacheEntryType enum to separate namespaceStephen Kelly2016-10-191-3/+3
| | | | 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-2/+1
|
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-114/+77
| | | | | | | | | | | | | 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-4/+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.
* Source: Stabilize include orderBrad King2016-04-291-0/+1
| | | | | Each source file has a logical first include file. Include it in an isolated block so that tools that sort includes do not move them.
* find_program: Fix regression in finding an already-known pathBrad King2015-10-301-0/+13
| | | | | | | | Changes in commit v3.4.0-rc1~124^2~1 (cmFindProgramCommand: Re-implement search using more flexible approach, 2015-09-01) did not preserve the behavior of looking for the given name with no search path at all. Fix this and add a test case covering finding an absolute path with no search directories.
* find_program: Optionally consider all names in each directoryBrad King2015-09-021-0/+41
| | | | | | | When more than one value is given to the NAMES option this command by default will consider one name at a time and search every directory for it. Add a NAMES_PER_DIR option to tell this command to consider one directory at a time and search for all names in it.
* cmFindProgramCommand: Re-implement search using more flexible approachBrad King2015-09-021-1/+96
| | | | | | | | Avoid using KWSys SystemTools::FindProgram because it does much more than we actually need for find_program and does not allow us to control the order of preference between directories and names. Create our own cmFindProgramHelper much like cmFindLibraryHelper but without all the find_library-specific parts.
* cmFindProgramCommand: Use Names member instead of passing itBrad King2015-09-021-9/+8
|
* cmState: Move CacheEntryType enum from cmCacheManager.Stephen Kelly2015-04-131-4/+3
|
* Remove some unneeded c_str calls.Stephen Kelly2014-11-231-1/+1
|
* strings: Remove redundant calls to std::string::c_str()Nils Gladitz2014-10-151-1/+1
| | | | | Replacements were detected and performed by the clang tool remove-cstr-calls on a linux build.
* Remove some c_str() calls.Stephen Kelly2014-03-111-3/+3
| | | | | | Use the clang RemoveCStrCalls tool to automatically migrate the code. This was only run on linux, so does not have any positive or negative effect on other platforms.
* Drop builtin command documentationBrad King2013-10-161-31/+0
| | | | | Drop all GetTerseDocumentation and GetFullDocumentation methods from commands. The command documentation is now in Help/command/*.rst files.
* Remove trailing whitespace from most CMake and C/C++ codeKitware Robot2012-08-131-20/+20
| | | | | | | | | | | | | | | | | Our Git commit hooks disallow modification or addition of lines with trailing whitespace. Wipe out all remnants of trailing whitespace everywhere except third-party code. Run the following shell code: git ls-files -z -- \ bootstrap doxygen.config '*.readme' \ '*.c' '*.cmake' '*.cpp' '*.cxx' \ '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \ '*.mm' '*.pike' '*.py' '*.txt' '*.vim' | egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' | egrep -z -v '^(Modules/CPack\..*\.in)' | xargs -0 sed -i 's/ \+$//'
* Fix crash if app bundle executeable couldn't be foundBjoern Ricks2012-02-251-1/+2
| | | | | | | | Fix a crash on Mac OS X if a programm can't be found as an application bundle. CFRelease MUST NOT be called on a NULL value. See https://developer.apple.com/library/mac/documentation/CoreFOundation/Reference/CFTypeRef/Reference/reference.html#//apple_ref/doc/c_ref/CFRelease
* Teach find_(library|package) about Linux multiarch (#12037)Brad King2011-06-081-0/+2
| | | | | | | | | | | | | Implement support for multiarch as specified here: http://wiki.debian.org/Multiarch https://wiki.ubuntu.com/MultiarchSpec Detect the <arch> part of <prefix>/lib/<arch> from the implicit library search path from each compiler to set CMAKE_<lang>_LIBRARY_ARCHITECTURE. Define CMAKE_LIBRARY_ARCHITECTURE using one of these values (they should all be the same). Teach the find_library and find_package commands to search <prefix>/lib/<arch> whenever they would search <prefix>/lib.
* Speedup find_* commands (#11412)Brad King2010-11-121-5/+6
| | | | | | | Delay computation of the command documentation until it is needed. It is wasteful to do it in the constructor on every call. Inspired-By: Christian Ehrlicher <Ch.Ehrlicher@gmx.de>
* Convert CMake to OSI-approved BSD LicenseBrad King2009-09-281-14/+9
| | | | | | | This converts the CMake license to a pure 3-clause OSI-approved BSD License. We drop the previous license clause requiring modified versions to be plainly marked. We also update the CMake copyright to cover the full development time range.