Commit Graph

336 Commits

Author SHA1 Message Date
Brad King
a5f7652fb9 Merge topic 'revert-file-alt-httpauth'
646eedcfcb Revert "file: Allow DOWNLOAD/UPLOAD using alternate authentication methods"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2858
2019-01-25 07:51:25 -05:00
Brad King
646eedcfcb Revert "file: Allow DOWNLOAD/UPLOAD using alternate authentication methods"
Revert commit 31301b46a7 (file: Allow DOWNLOAD/UPLOAD using alternate
authentication methods, 2018-08-28, v3.13.0-rc1~155^2).  It regressed
support for password-protected redirects.

Fixes: #18691
2019-01-24 14:14:40 -05:00
Tushar Maheshwari
0f08ed8936 cmSystemTools: Silence CreateLink and CreateSymlink errors
If provided, report errors to a std::string.
This allows "silent" fallback to another flow, like COPY_ON_ERROR.
2019-01-16 10:03:35 -05:00
Tushar Maheshwari
81650e488c cmFileCommand: Add CREATE_LINK subcommand
This brings the functionality of `cmake -E create_symlink` and more to scripts.

The default behavior is to create hard links.
The `SYMBOLIC` argument can be used to create symlinks instead.

The `COPY_ON_ERROR` argument enables a fallback to copying the file in case the link fails.

The `RESULT <var>` retrieves the error message generated by the system.
It is set to "0" on success.

Fixes: #16926
2019-01-16 10:03:35 -05:00
Brad King
bd54cc774a Merge topic 'semi-warnings'
b056bc3425 Fix most clang -Wextra-semi-stmt warnings in C++ files

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2795
2019-01-16 09:52:45 -05:00
Bruno Manganelli
cc2a5261f8 Factor out enum MessageType into dedicated header
Reduce the number of files relying on `cmake.h`.
2019-01-16 08:16:31 -05:00
Sean McBride
b056bc3425 Fix most clang -Wextra-semi-stmt warnings in C++ files
Suppress one in code generated by flex.
2019-01-15 14:09:46 -05:00
Brad King
cd0881be61 IWYU: Update CMake code for IWYU built with Clang 6
IWYU now correctly requires `<utility>` for `std::move`.  It also
requires a container header when used via a range-based for loop.
2019-01-15 10:00:50 -05:00
Bruno Manganelli
5bcfe98bd5 Source: Fix various compiler warnings in Visual Studio 2017 2019-01-09 08:25:10 -05:00
Regina Pfeifer
b2aa3aedea clang-tidy: Use default member initialization 2018-12-15 10:52:37 +01:00
Kyle Edwards
31840e363f file: Fix formatting of error in SIZE sub-command 2018-12-06 10:28:16 -05:00
Kyle Edwards
98a39be6cf file: Add READ_SYMLINK sub-command 2018-12-06 10:11:51 -05:00
Brad King
5daf7d92f8 Merge topic 'file-size'
12b471e828 file: add SIZE option

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2639
2018-11-28 09:05:16 -05:00
Wouter Klouwen
12b471e828 file: add SIZE option
This commit adds the SIZE option to file(). It returns the file size of
the given path if it exists and produces an error if not.
2018-11-27 08:50:36 +00:00
Regina Pfeifer
ce2570b207 clang-tidy: Enable checks from bugprone set 2018-11-21 07:47:40 -05:00
Regina Pfeifer
5731ec30f0 clang-tidy: fix warnings from version 7
Fix some warnings that are new since clang-tidy version 4, and update
`.clang-tidy` to suppress the rest.
2018-11-20 10:36:08 -05:00
Cengizhan Pasaoglu
c67ab22cdc Using front() and back() instead of calculations 2018-11-06 21:43:33 +03:00
Kyle Edwards
5e61b79b82 install: Set permissions on directories created by install(DIRECTORY)
The directories that are implicitly created by install(DIRECTORY)
were not having their permissions being set by
CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS. This change refactors
cmFileCopier to take this into account for directory installation.
2018-10-01 16:28:43 -04:00
Vitaly Stakhovsky
6f16be6a62 Remove unnecessary c_str() calls
Use the new IsOn(),IsOff() overloads.
2018-09-05 15:12:57 -04:00
Brad King
e16568c293 Merge topic 'file-alt-httpauth'
31301b46a7 file: Allow DOWNLOAD/UPLOAD using alternate authentication methods

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2320
2018-08-31 14:45:11 -04:00
Clinton Stimpson
31301b46a7 file: Allow DOWNLOAD/UPLOAD using alternate authentication methods 2018-08-30 10:38:28 -04:00
Vitaly Stakhovsky
c8fd23ec6f cmMakefile: return directories as const std::string& 2018-08-27 14:07:43 -04:00
Vitaly Stakhovsky
69ca85cc7f Remove unnecessary c_str() in RegularExpression::find calls 2018-08-07 15:28:24 -04:00
David Faure
bdd0174df1 file(WRITE): Avoid toggling permissions between 644 and 664
On systems with umask 022, this function would set permissions
to 664 and restore them to 644 at the end, every single time it was
called (which is many times on e.g. install_manifest.txt).

The intent of the code was to make non-writable files temporarily
writable and to restore permissions in the end, but really, if it's
already user-writable there's no point in toggling this back and forth.
2018-08-01 09:05:33 -04:00
Devin Nakamura
b872f5b303 file(STRINGS): Use isprint() to test character type
Use the more portable `isprint()` function to test characters rather
than using hard-coded hex values.  The function is documented by the C++
standard to return non-zero for the exact range of hex values we
previously hard-coded, so this should not change behavior.
2018-07-10 13:57:07 -04:00
Brad King
e9ec0cc3bb Merge topic 'update-kwsys'
b41b30f16e Update use of KWSys SystemTools::SplitString for new signature
f2d97c1cdf Merge branch 'upstream-KWSys' into update-kwsys
6d7fdedde6 KWSys 2018-06-22 (49068d94)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2165
2018-06-25 09:57:35 -04:00
Brad King
b41b30f16e Update use of KWSys SystemTools::SplitString for new signature 2018-06-22 13:38:18 -04:00
Brad King
142a625729 file: Drop error cases added by CMake 3.12.0-rc1 to avoid regressions
Refactoring in commit v3.12.0-rc1~418^2~3 (Refactor HandleGlobCommand,
2018-02-13) introduced error diagnostics for argument combinations that
were previously accepted.  Restore acceptance to avoid regressing
projects that used those combinations even if they do not make sense.

Fixes: #18097
2018-06-22 09:39:05 -04:00
Kitware Robot
d7204e649e Revise C++ coding style using clang-format-6.0
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.
2018-06-01 09:53:42 -04:00
Ruslan Baratov
2db4945150 file(WRITE): Report errors during write operation
We already report an error if the file cannot be opened for writing.
Add another check to report an error if a write operation itself fails.
2018-05-16 10:34:28 -04:00
Yves Frederix
6dcd1bfa39 file(INSTALL): Preserve file time when writing NTFS alternate stream
When cross-compiling on a Windows host, we use a `:cmake_mode_t` NTFS
alternate stream to store the file mode for use during packaging.
Writing to this stream changes the file modification time, so save and
restore the original modification time since we are not modifying the
real file content.

Fixes: #17922
2018-04-23 11:37:36 -04:00
Shane Parris
ca0befc2e1 Add CONFIGURE_DEPENDS flag support to cmFileCommand::HandleGlobCommand 2018-03-29 10:58:03 -04:00
Shane Parris
b688d4fd22 file(GLOB): Ensure entire file list is sorted 2018-03-07 12:12:19 -05:00
Shane Parris
fcaa134c6c Refactor HandleGlobCommand 2018-02-28 09:34:47 -05:00
Shane Parris
602988e1e5 Adds file(TOUCH) and file(TOUCH_NOCREATE) sub-commands 2018-02-15 10:54:18 -05:00
Pavel Solodovnikov
653b894683 Reduce raw string pointers usage.
* 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.
2018-01-31 18:23:03 +03:00
Pavel Solodovnikov
c85bb007df Reduce allocation of temporary values on heap.
- Use `std::move` while inserting temporary results into vectors.
- Change `push_back` to `emplace_back` where appropriate.
2018-01-26 13:24:45 +03:00
Domen Vrankar
670ad047b3 Move file/dir permissions code to common file. 2017-11-08 20:27:11 +01:00
Domen Vrankar
deeba85f81 CMake: enable setting default dir creation permissions
Introduces CMAKE_DEFAULT_DIRECTORY_INSTALL_PERMISSIONS
variable which enables the user to specify the default
permissions for directory creation. This setting is then
used to auto set the permissions on directories which
are implicitly created by install() and file(INSTALL)
commands such as CMAKE_INSTALL_PREFIX directories.
2017-11-08 20:27:03 +01:00
Shane Parris
5d67e9025d file(DOWNLOAD|UPLOAD): Add 'NETRC' and 'NETRC_FILE' suboption 2017-10-18 15:21:42 -04:00
Matthias Maennich
870dd06da1 Fix left-over occurrences of else-after-return
Fix issues diagnosed by clang-tidy [readability-else-after-return]

These were mostly only showing up on OSX.

Signed-off-by: Matthias Maennich <matthias@maennich.net>
2017-09-28 07:23:42 -04:00
Matthias Maennich
f0489856e3 Retire std::auto_ptr and its macro CM_AUTO_PTR
Signed-off-by: Matthias Maennich <matthias@maennich.net>
2017-09-26 00:07:19 +02:00
Brad King
7c28081c14 Merge topic 'string-clear'
5db3aac1 Meta: replace empty-string assignments with `clear()`.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1276
2017-09-19 08:27:00 -04:00
Pavel Solodovnikov
5db3aac111 Meta: replace empty-string assignments with clear(). 2017-09-16 02:26:49 +03:00
Brad King
0b33aee48b Use C++11 override instead of CM_OVERRIDE
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'
2017-09-15 10:06:41 -04:00
Pavel Solodovnikov
7d5095796a Meta: modernize old-fashioned loops to range-based for.
Changes done via `clang-tidy` with some manual fine-tuning
for the variable naming and `auto` type deduction
where appropriate.
2017-09-12 16:22:47 +03:00
Daniel Pfeifer
190e3825d4 Replace C-style casts 2017-08-27 09:58:46 +02:00
Daniel Pfeifer
5962db4389 Use C++11 nullptr 2017-08-24 23:39:47 +02:00
Nils Gladitz
5299141320 CPackDeb: Enable the DEB generator on Windows
While some features require external Unix tools the
generator is mostly portable.

By enabling it on Windows it can be used for cross platform
packaging.
2017-06-28 19:55:12 +02:00
Brad King
c6ea3f01c3 Merge topic 'lint-function-args'
b1ec5dea Pass large types by const&, small types by value

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !927
2017-06-05 09:44:24 -04:00