Getting ready

The source code we will compile is one of the examples for the filesystem library provided by Boost to interact with the filesystem. This library is conveniently cross-platform and abstracts the differences between operating systems and filesystems into a coherent, high-level API. The following example code (path-info.cpp) will accept a path as an argument and print a report about its components to the screen:

#include <iostream>#include <boost/filesystem.hpp>using namespace std;using namespace boost::filesystem;const char *say_what(bool b) { return b ? "true" : "false"; }int main(int argc, char *argv[]) {  if (argc < 2) {    cout        << "Usage: path_info path-element [path-element...]\n" "Composes a path via operator/= from one or ...

Get CMake Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.