1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-03 12:39:25 +08:00

525 Commits

Author SHA1 Message Date
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
Daniel Pfeifer
b1ec5deaf1 Pass large types by const&, small types by value 2017-06-04 00:48:21 +02:00
Daniel Pfeifer
8d7b3ef5d4 Provide and use CM_FALLTHROUGH 2017-06-03 08:38:51 +02:00
Pavel Solodovnikov
86dc86dd6c Add const-reference qualifications 2017-05-26 19:50:11 +03:00
Brad King
67d5593efa Merge topic 'mingw-w64-compile'
9557b403 cmFileCommand: Fix build on mingw-w64
845f5e3c bootstrap: fix build on mingw-w64

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !837
2017-05-16 09:52:42 -04:00
Aleksey Chernov
9557b403f5 cmFileCommand: Fix build on mingw-w64
Include header needed for `CP_ACP`.
2017-05-15 14:25:37 -04:00
Ben Boeckel
3e027d9def c++: prefer vectors over lists
None of these usages of `std::list` were inserting or removing elements
in the middle of the structure, so there were no benefits to using it.

Other uses were related to C pointers being stable in a list of strings
whereas in a vector of strings, small pointer optimizations could be
moved and become invalid after a modification to the hosting vector.
None of these uses modified the vector after handing out a C string to
an external store.
2017-05-04 11:17:49 -04:00
Daniel Pfeifer
b26577c92a clang-tidy: remove else after break and continue 2017-04-21 10:44:07 +02:00
Brad King
99b90dbf3c file: Add COPY/INSTALL option for fixed layout relative to a directory
Add a `FILES_FROM_DIR` option to install a specific set of files
specified relative to a given directory and preserve their layout
in the destination.  Currently we intend to use this internally
to implement other things so we don't provide an `install()`
porcelain or documentation yet.
2017-04-13 16:32:51 -04:00
Brad King
dadf1570d9 file: Refactor COPY/INSTALL relative path handling
Delay conversion to absolute path until the last moment.
2017-04-13 16:32:46 -04:00
Daniel Pfeifer
1d829c862c Use quotes for non-system includes
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'
2017-04-11 22:35:21 +02:00
Brad King
d66081b546 Merge topic 'iwyu'
48cfb295 cmFortranParser: remove unnecessary typedef
90bb5f64 cmCommandArgumentParserHelper: remove unnecessary include
ab5f4e81 cmFortranParserImpl: remove unnecessary include
f8ed8bef testEncoding: use cmsys::ifstream
8647c6cd testEncoding: include <cmsys/ConsoleBuf.hxx> on Windows only
21a6ed49 cmFileCommand: add <cm_curl.h> include
a2275bdd cmFileCommand: remove unnecessary friend declaration

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !626
2017-03-30 08:58:26 -04:00