Commit Graph

34 Commits

Author SHA1 Message Date
Kyle Edwards
5a8a9f7229 Ninja: Add multi-config variant
Co-Authored-by: vector-of-bool <vectorofbool@gmail.com>
2019-12-13 10:51:46 -05:00
Brad King
a1eb03569d file: Change REMOVE to ignore empty names
Previously code like

    file(REMOVE_RECURSE "${accidentally_missing_variable}")

treated the empty string as a relative path with respect to the
current directory and removed its contents.  Change this behavior
to ignore the empty string with a warning instead.

Normally such behavior changes are done with a policy, but in this case
such code is likely a real bug in project code that can delete data.

Fixes: #19274
2019-05-21 09:25:32 -04:00
Kyle Edwards
e3ff7ced63 file(INSTALL): Add FOLLOW_SYMLINK_CHAIN argument 2019-05-16 15:25:33 -04:00
Tushar Maheshwari
593d986470 Tests: Avoid cross-device links in CREATE_LINK test
Add a test for COPY_ON_ERROR to cover that scenario.
2019-01-16 10:03:35 -05:00
Tushar Maheshwari
9a3d85cfc5 Tests: Skip symlink tests on Windows 2019-01-16 10:03:35 -05:00
Tushar Maheshwari
e68ea269d7 Tests: CREATE_LINK subcommand negative test case 2019-01-16 10:03:35 -05:00
Tushar Maheshwari
45aa9c65a1 Tests: file CREATE_LINK subcommand test cases 2019-01-16 10:03:35 -05: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
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
Kyle Edwards
514f0b572e Testing: Update hard-coded line numbers to [0-9]+ in some tests 2018-10-10 10:06:27 -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
Shane Parris
20612978c8 Add tests for file(GLOB) CONFIGURE_DEPENDS flag 2018-04-01 23:16:12 -04:00
Shane Parris
87a6816baf Add test for sorting and deduping of file(GLOB) result 2018-03-07 12:12:19 -05:00
Shane Parris
915b71010c Enhance RunCMake test coverage for file(GLOB) 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
Shane Parris
754e39dd36 Add testcases for file(DOWNLOAD|UPLOAD) netrc options 2017-10-18 15:21:42 -04: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
Domen Vrankar
8e8f1118b9 handle non-existing symlink creation locations 2017-03-29 00:22:52 +02: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
14c771530a Tests: Fix file:// URLs given to curl
Since upstream curl commit curl-7_52_0~131 (URL-parser: for
file://[host]/ URLs, the [host] must be localhost, 2016-11-11) we can no
longer use URLs of the form `file://c:/...` on Windows.  These worked
only accidentally before.  Use `file:///c:/...` instead.
2017-02-10 13:10:07 -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
Brad King
4356bd7fe3 Merge topic 'file-curl-httpheader'
8f6cb366 file(DOWNLOAD|UPLOAD): Add HTTPHEADER suboption
2016-09-16 10:21:23 -04:00
Ruslan Baratov
8f6cb36695 file(DOWNLOAD|UPLOAD): Add HTTPHEADER suboption 2016-09-15 21:41:39 +03:00
Ruslan Baratov
a788cf3092 Tests: Add case for file(LOCK) with lower-cased path
The KWSys update in commit d28e4467 (KWSys 2016-09-14 (c4049689))
fixed this case, so add it to the test suite.

Closes: #16295
2016-09-15 11:44:28 -04: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
Reiner Herrmann
edcccde7d6 file: Sort GLOB results to make it deterministic (#14491)
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/).
2016-05-17 10:12:11 -04:00
Brad King
6c9586f9c7 file(DOWNLOAD): Fill STATUS variable on hash mismatch (#15987)
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>
2016-02-25 11:40:50 -05:00
Domen Vrankar
a2c068a7ce file: Teach GLOB to list directories optionally
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.
2015-03-20 09:45:25 -04:00
Ruslan Baratov
e6db4c5a4e file: Add LOCK subcommand to do file and directory locking
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.
2014-12-03 09:47:44 -05:00
Brad King
abebcd235c file(INSTALL): Add undocumented options to control output verbosity
Create options "MESSAGE_ALWAYS", "MESSAGE_LAZY", and "MESSAGE_NEVER" to
specify whether to print the "Installing" and "Up-to-date" messages.
Extend the RunCMake.file test with cases covering these options.
2014-06-24 13:11:45 -04:00
Brad King
464567a577 file(INSTALL): Report existing DIRECTORY as Up-to-date
Teach cmFileCopier::InstallDirectory to detect whether the destination
directory exists.  If so, report it as "Up-to-date" instead of
"Installing".  This resolves message asymmetry with file installations.

Extend the RunCMake.file and RunCMake.install tests to check the
installation output on both the first and second run.

Suggested-by: J Decker <d3ck0r@gmail.com>
2014-06-24 12:52:11 -04:00
Brad King
2c448dbfe7 file: Report system error on failure to open file 2014-05-20 11:07:51 -04:00