diff options
author | Tushar Maheshwari <tushar27192@gmail.com> | 2018-12-27 11:58:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-01-16 15:03:35 (GMT) |
commit | 81650e488c734702384ef903630838015a3f81b1 (patch) | |
tree | 7391c238c012b6e34ed73130d588bf80a404122e /Source/cmSystemTools.h | |
parent | c59eae7ebc5423c2b06befd762f8639b0f23b7a0 (diff) | |
download | CMake-81650e488c734702384ef903630838015a3f81b1.zip CMake-81650e488c734702384ef903630838015a3f81b1.tar.gz CMake-81650e488c734702384ef903630838015a3f81b1.tar.bz2 |
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
Diffstat (limited to 'Source/cmSystemTools.h')
-rw-r--r-- | Source/cmSystemTools.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index c0999e7..15f27e5 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -530,6 +530,11 @@ public: static bool CreateSymlink(const std::string& origName, const std::string& newName); + /** Create a hard link if the platform supports it. Returns whether + creation succeeded. */ + static bool CreateLink(const std::string& origName, + const std::string& newName); + private: static bool s_ForceUnixPaths; static bool s_RunCommandHideConsole; |