Skip to content

Instantly share code, notes, and snippets.

@jakelevi1996
Last active March 13, 2020 16:23
Show Gist options
  • Select an option

  • Save jakelevi1996/41325a18b7cd4e94d385d80acd2c03ed to your computer and use it in GitHub Desktop.

Select an option

Save jakelevi1996/41325a18b7cd4e94d385d80acd2c03ed to your computer and use it in GitHub Desktop.
Compiling with CMake

Compiling with CMake

As described on the CMake website, "CMake is an open-source, cross-platform family of tools designed to build, test and package software".

To compile a source directory containing a valid CMakeLists.txt file, create and navigate into a dedicated build directory (which may be named build, for example). Run the following command to generate a build system for the current project:

cmake path/to/src

Run the following command to build a CMake-generated project binary tree:

cmake --build .

The resulting executable should be found in the make directory or a Debug or Release build configuration subdirectory.

Source code

The source code for CMake is available on Gitlab.

Tutorial

CMake also includes an official tutorial, for which the source code is available in the Help/guide/tutorial directory of the CMake Gitlab repository.

Documentation

The CMake documentation contains pages on cmake-commands (EG add_executable, target_include_directories, etc.) and cmake-variables (EG CMAKE_CXX_STANDARD, PROJECT_BINARY_DIR, etc.), among other features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment