Using CMake for platform-independent commands
One of the keystones for the success of CMake is that it allows you to build the same software on a multitude of platforms. On the other hand, this means that CMakeLists.txt
must be written in a way that does not assume a certain platform or compiler must be used. This can be challenging, especially when you're working with custom tasks. A big help here is that the cmake
command-line utility supports the -E
flag, which can be used to perform common tasks such as file operations and creating hashes. Most of the cmake -E
commands are for file-related operations such as creating, copying, renaming, and deleting files, as well as creating directories. On systems that support filesystem links, CMake can also create symbolic links or hard links between files. Additionally, CMake can create file archives using the tar
command and concatenate text files with the cat
command. It can also be used to create various hashes for files.
There...