summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Use better KWSys SystemTools::GetEnv and HasEnv signaturesDāvis Mosāns2016-07-181-5/+6
|
* Avoid using KWSys auto_ptr by adopting it ourselvesBrad King2016-06-291-7/+7
| | | | | | | | | | | | 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-16/+16
|
* mark functions with CM_OVERRIDEDaniel Pfeifer2016-06-271-9/+9
|
* Remove redundant arguments from fstream constructorsDaniel Pfeifer2016-06-141-2/+2
| | | | Don't pass the default value of the openmode parameter explicitly.
* file: Sort GLOB results to make it deterministic (#14491)Reiner Herrmann2016-05-171-0/+1
| | | | | | | | | | | | | | | | | Even though the `file(GLOB)` documentation specifically warns against using it to collect a list of source files, projects often do it anyway. Since it uses `readdir()`, the list of files will be unsorted. This list is often passed directly to add_executable / add_library. Linking binaries with an unsorted list will make it unreproducible, which means that the produced binary will differ depending on the unpredictable `readdir()` order. To solve those reproducibility issues in a lot of programs (which don't explicitly `list(SORT)` the list manually), sort the resulting list of the `file(GLOB)` command. A more detailed rationale about reproducible builds is available [here](https://reproducible-builds.org/).
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-1805/+1169
| | | | | | | | | | | | | 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-35/+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/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Source: Stabilize include order of sys/types.h before sys/stat.hBrad King2016-05-031-1/+3
| | | | | Include the two headers in an isolated block with a comment separating them so that tools that re-order includes do not re-order these.
* Format include directive blocks and ordering with clang-formatBrad King2016-04-291-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* 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.
* Fix spelling typos in comments and documentation (#16037)Felix Geyer2016-03-291-1/+1
| | | | | The Debian package checker tool (lintian) detected several typos in CMake.
* file(DOWNLOAD): Fill STATUS variable on hash mismatch (#15987)Brad King2016-02-251-0/+9
| | | | | | | | | Although we fail with an error on a hash mismatch, it is not a fatal error so the script may continue processing. If the download itself had no error then report in the STATUS variable that the operation was not successful due to the hash mismatch. Suggested-by: Tobias Hieta <tobias@hieta.se>
* Port CMake from cmIML to KWIMLBrad King2015-12-181-2/+2
| | | | KWIML no longer uses a configured prefix.
* Remove unused cmLocalGenerator include.Stephen Kelly2015-10-051-1/+0
|
* cmMakefile: Store EvaluationFiles.Stephen Kelly2015-08-011-5/+2
| | | | | Relieve the cmGlobalGenerator of this responsibility. Evaluate the generator expressions in the context of the cmLocalGenerator.
* cmAlgorithms: Rename cmRange to cmMakeRange.Stephen Kelly2015-07-221-1/+1
|
* Genex: Store a backtrace, not a pointer to one.Stephen Kelly2015-07-171-2/+2
| | | | | | | | | | The storage of a pointer means that the ownership and lifetime are externally determined, which is harder to reason about. It also imposes API constraints, requiring APIs to return references to backtraces. This pointer storage was introduced in commit v3.1.0-rc1~425^2~3 (genex: remove the need for backtraces, 2014-05-23). As backtraces are now cheap to copy around, just do that instead.
* Fix preprocessor checks WIN32 => _WIN32Brad King2015-06-151-3/+3
| | | | | | The latter is predefined by Windows toolchains and is more reliable. Reported-by: Michael Stürmer <michael.stuermer@schaeffler.com>
* cmFileCommand: Fix implementation of CMP0009.Stephen Kelly2015-06-091-8/+4
|
* cmFileCommand: Do not log raw protocol data from curl (#15589)Brad King2015-05-281-3/+26
| | | | | | Teach cmFileCommandCurlDebugCallback to filter the debug data by type and show only summary information instead of the raw data. This avoids allocating memory for all data transferred by UPLOAD or DOWNLOAD.
* cmFileCommand: Clarify logic for populating LOG variableBrad King2015-05-281-1/+1
| | | | | | | The chunkDebug buffer we use to accumulate the LOG variable content is populated if and only if a log variable was requested by the call, but it is much clearer to check that a log variable was requested explicitly before populating it.
* cmFileCommand: Rename variable verboseLog => logVarBrad King2015-05-281-5/+4
| | | | | This makes the LOG variable name consistent between UPLOAD and DOWNLOAD implementations.
* cmFileCommand: Remove leftover no-op debugging logicBrad King2015-05-281-11/+0
| | | | | | Remove debugging logic left from commit v2.6.0~305 (add DOWNLOAD option to FILE command, 2008-02-06). The CURLE_OPERATION_TIMEOUTED code path does nothing that the code immediately after it does not do.
* Merge topic 'refactor-cmPolicies'Brad King2015-05-051-4/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 013ada80 cmPolicies: Implement PolicyMap in terms of bitset. be6664c2 cmPolicies: Implement abstraction for PolicyMap. de211686 Port to static cmPolicies API. 13981f20 cmPolicies: Make all API static. 23e2bcc8 cmPolicies: Remove unused DefinePolicy method. 5641ba4f cmPolicies: Remove unused cmPolicy class. 3de54497 cmPolicies: Loop over all policies using enum constants. 387aff20 cmPolicies: Trivialize GetPolicyStatus method. dbf680d6 cmPolicies: Use more-direct ID access. 8c204133 cmPolicies: Implement in terms of public API. e3a8c029 cmPolicies: Make private method file-static. cb765af0 cmPolicies: Implement short description access with XMacros. 5df267fa cmPolicies: Implement version check with XMacro. 2235cfeb cmPolicies: Implement id to version with XMacro. 05d84388 cmPolicies: Implement id to string conversion with XMacro. 6eaade8a cmPolicies: Introduce XMacro table for policy data. ...
| * Port to static cmPolicies API.Stephen Kelly2015-05-041-4/+2
| |
* | Port to cmMakefile::GetGlobalGenerator.Stephen Kelly2015-05-031-4/+3
|/
* cmMakefile: Rename GetCurrent{Output,Binary}Directory.Stephen Kelly2015-04-201-2/+2
| | | | Match names used in CMake code.
* cmMakefile: Rename GetCurrent{,Source}Directory.Stephen Kelly2015-04-201-10/+10
| | | | Match the names used in cmake code.
* Add some missing includes.Stephen Kelly2015-04-121-0/+2
|
* Fix warnings from clang scanbuild.Bill Hoffman2015-03-251-0/+1
|
* file: Teach GLOB to list directories optionallyDomen Vrankar2015-03-201-3/+59
| | | | | | GLOB lists directories by default and GLOB_RECURSE does not. LIST_DIRECTORIES enables user to control the behavior explicitly for consistently for both GLOB and GLOB_RECURSE.
* Include cmAlgorithms where it is used.Stephen Kelly2015-03-101-0/+1
|
* Merge topic 'install-manifest-optimize'Brad King2015-02-271-1/+4
|\ | | | | | | | | c4814174 install: Write the entire installation manifest at once
| * install: Write the entire installation manifest at onceRobert Goulet2015-02-261-1/+4
| | | | | | | | | | Avoid a separate open/close for each file installed. Use a single file(WRITE) instead of a loop with file(APPEND).
* | Use cmJoin to accumulate string ranges.Stephen Kelly2015-02-111-5/+1
| | | | | | | | | | | | | | | | Avoid using the std::accumulate algorithm which is designed for numeric types, not complex types. It introduces unneccessary copies. Initialize variables where they are populated.
* | Remove use of cmsys_stl.Stephen Kelly2015-02-051-2/+2
|/ | | | It is not needed.
* file: Teach STRINGS to support UTF-16 and UTF-32 encodingsJustin Borodinsky2015-01-271-3/+61
|
* cmake: Use a default CA path when not using system curlBrad King2015-01-231-4/+5
| | | | | | | | | | | | | | | | | | | | When using system curl, we trust it to be configured with desired CA certs. When using our own build of curl, we use os-configured CA certs on Windows and OS X. On other systems, try to achieve this by searching for common CA cert locations. According to a brief investigation, the curl packages on popular Linux distros are currently configured as: * Arch: /etc/ssl/certs/ca-certificates.crt * Debian with OpenSSL: /etc/ssl/certs * Debian with GNU TLS: /etc/ssl/certs/ca-certificates.crt * Debian with NSS: /etc/ssl/certs/ca-certificates.crt * Fedora: /etc/pki/tls/certs/ca-bundle.crt * Gentoo with OpenSSL: /etc/ssl/certs * Gentoo without OpenSSL: /etc/ssl/certs/ca-certificates.crt Teach CMake and CTest to look for these paths and use them as a CA path or bundle when no other os-configured or user-specified CAs are available.
* Replace 'foo.length() >= 1' pattern with !foo.empty()Stephen Kelly2015-01-181-1/+1
|
* Replace foo.size() pattern with !foo.empty().Stephen Kelly2015-01-181-10/+10
|
* Replace 'foo.size() == 0' pattern with foo.empty().Stephen Kelly2015-01-181-1/+1
|
* Replace 'foo.size() > 0' pattern with !foo.empty().Stephen Kelly2015-01-181-3/+3
|
* Port all cmOStringStream to std::ostringstream.Stephen Kelly2015-01-111-49/+49
| | | | All compilers hosting CMake support the std class.
* file: Use 'long' to represent the parsed LOCK TIMEOUT valueRuslan Baratov2014-12-051-4/+5
| | | | | | | | | Convert the StringToInt helper into a StringToLong helper with a 'long' result type. This will make the helper more useful to other callers that want to use strtol. While at it, also check errno after calling strtol in case the conversion fails with a range error.
* file: Add LOCK subcommand to do file and directory lockingRuslan Baratov2014-12-031-0/+203
| | | | | | | | | Provide options to fail without blocking or to block up to a timeout. Provide options to specify the scope containing the lock so it can be released automatically at the end of a function, file, or process. Extend the RunCMake.file test with cases covering the file(LOCK) command usage and error cases.
* Remove some unneeded c_str calls.Stephen Kelly2014-11-231-2/+2
|
* Encoding: Use encoding libcurl expects with file: urls.Clinton Stimpson2014-11-051-0/+38
| | | | | | | | For unescaped file: URLs on Windows, libcurl expects the ANSI code page. This fixes the CMake.FileUpload test when CMake is configured to use UTF-8 internally with a non-ascii build directory name.
* Merge topic 'remove-borland-build'Brad King2014-10-211-2/+0
|\ | | | | | | | | 2db55ffa Remove borland workarounds.