Commit Graph

299 Commits

Author SHA1 Message Date
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
Daniel Pfeifer
21a6ed49f2 cmFileCommand: add <cm_curl.h> include 2017-03-29 18:48:47 +02:00
Daniel Pfeifer
a2275bdd63 cmFileCommand: remove unnecessary friend declaration 2017-03-29 18:48:47 +02:00
Domen Vrankar
8e8f1118b9 handle non-existing symlink creation locations 2017-03-29 00:22:52 +02:00
Daniel Pfeifer
e9fc7ff505 Add self-sufficient wrapper for <sys/stat.h> 2017-03-24 22:58:25 +01:00
Florian Apolloner
a52faa1fcb file: Add READ_ELF command to parse ELF binaries
Leave it undocumented for now because we intend to use it internally and
it cannot be made available everywhere.
2017-03-10 10:54:53 -05:00
Brad King
2bba0bfc2c file: Fix crash on GLOB with no expressions after LIST_DIRECTORIES
Since commit v3.3.0-rc1~318^2~1 (file: Teach GLOB to list directories
optionally, 2015-03-17) using `LIST_DIRECTORIES` followed by no
expression causes a crash.  Fix the logic to avoid the crash.

Fixes: #16565
2017-01-16 10:47:32 -05:00
Daniel Pfeifer
58c66393cf clang-tidy: apply readability-static-definition-in-anonymous-namespace fixes 2016-12-12 14:04:15 -05:00
Daniel Pfeifer
a74e689348 clang-tidy: apply readability-redundant-string-init fixes 2016-12-12 14:04:13 -05:00
Daniel Pfeifer
7b4244aceb iwyu: Fix more findings 2016-11-28 14:06:40 -05:00
Brad King
60939702e1 file: Add support for SHA-3 algorithms 2016-11-10 16:41:45 -05:00
Brad King
de53eb18ab Merge topic 'import-librhash'
cd8a57ae Add option to build CMake against a system librhash
71180fc8 FindLibRHash: Add module to find the librhash package
3216e94c Remove unused cm_sha2 infrastructure
5420278d Port hash computation to cmCryptoHash
9a596b33 cmCryptoHash: Re-implement in terms of librhash
47f91a61 cmCryptoHash: Avoid using subclasses at client sites
d0ff3e70 librhash: Port to KWIML for ABI and integer type information
465a85fb librhash: Avoid signed left-shift overflow
fc2cb74f librhash: Implement bswap_32 as a function even in strict C90 mode
0bd333bc librhash: Implement bswap_64 even in strict C90 mode
7189d62c librhash: Use __builtin_bswap{32,64} on Clang
af7ebf8a librhash: Install COPYING file with CMake documentation
bb01f20e librhash: Disable warnings to avoid changing 3rd party code
31bb727f librhash: Build the library within CMake
53048afa librhash: Remove source fragments not needed for CMake
5cb1b345 Merge branch 'upstream-librhash' into import-librhash
...
2016-11-10 08:34:28 -05:00
Brad King
5420278dc8 Port hash computation to cmCryptoHash
Avoid using KWSys MD5 or `cm_sha2` and use the `cmCryptoHash`
abstraction instead.
2016-11-10 08:29:38 -05:00
Daniel Pfeifer
2e620f0b38 Fix several include-what-you-use findings 2016-11-08 09:42:04 -05:00
Clinton Stimpson
baead1e2a8 Encoding: Remove option to use ANSI code page internally
The switch to use UTF-8 encoding has been defaulted to on for quite some
time since commit v3.2.0-rc1~116^2 (Encoding: Switch to use UTF-8
internally by default on Windows, 2014-12-26).
2016-11-02 08:48:34 -06:00
Daniel Pfeifer
602b78aa79 Remove redundant c_str() calls 2016-10-30 18:34:06 +01:00
Daniel Pfeifer
e81c323da9 Include necessary headers in commands 2016-10-26 09:02:44 +02:00
Daniel Pfeifer
569509f4bf Fix newly discovered clang-tidy issues
Clang-tidy reports some issues only from the currently compiled source
file and its associated header file.  Separating the compilation of
commands exposed some clang-tidy issues that were not reported previously.
Fix them.
2016-10-21 21:32:43 +02:00
Daniel Pfeifer
effa6c8343 fix more issues reported by clang-tidy 2016-10-20 08:48:20 -04:00
Brad King
86578eccf2 Simplify CMake per-source license notices
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.
2016-09-27 15:14:44 -04:00
Daniel Pfeifer
809ca6c81f Use braces around statements 2016-09-16 22:52:02 +02:00
Daniel Pfeifer
516f8edb2e Avoid else after return 2016-09-16 22:45:24 +02:00
Ruslan Baratov
8f6cb36695 file(DOWNLOAD|UPLOAD): Add HTTPHEADER suboption 2016-09-15 21:41:39 +03:00
Ruslan Baratov
e5ba1041be file(DOWNLOAD|UPLOAD): Add 'USERPWD' suboption 2016-09-13 20:24:12 +03:00
Ruslan Baratov
4dd997da54 file(DOWNLOAD|UPLOAD): Warn on unexpected arguments
Emit warning message on unparsed argument instead of silently ignoring it.
Can't stop with the error message because it may break old code.
2016-09-09 23:19:39 +03:00
Dāvis Mosāns
b1f87a50b3 Use better KWSys SystemTools::GetEnv and HasEnv signatures 2016-07-18 09:51:01 -04:00
Brad King
b5ec5b0901 Avoid using KWSys auto_ptr by adopting it ourselves
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|'
2016-06-29 09:47:58 -04:00