Using CMake

A brief overview of using CMake using sortDevOps as an example:

  1. Assume code is in a source directory, e.g., /sortDevOps
  2. Many Makefiles assume an in-source build where the generated object code, libraries, and executables are created in the source directory

    CMake is typically used with an out of source build where the generated files are in a separate directory from the source. This separation:

    Create a build directory. Typically these are at the same level as the source and have a name based on the source directory name, e.g., /sortDevOps-Build.

  3. Move into the build directory
  4. Invoke the cmake command to generate the Makefile

     cmake /sortDevOps
    
  5. Build and run using the typical Makefile commands: make; make run; make test