CMake

Getting Started with CMake: Helpful Resources

Updated: 20190909

I've started familiarizing myself with CMake for a client's project. I was surprised at how few tutorials and good references exist on the internet. Here's a list of resources that I have found to be helpful.

Table of Contents:

  1. Learning CMake
  2. Videos
  3. Cheat Sheets
  4. Documentation
  5. Project Skeletons
  6. List of Global Variables

Learning CMake

Videos

Cheat Sheets

Documentation

Project Skeletons

List of Global Variables

  • CMAKE_BINARY_DIR
    • Same as CMAKE_SOURCE_DIR for in-source builds
    • Otherwise, top-level directory of your build tree
  • CMAKE_SOURCE_DIR
    • Top-level source directory
  • EXECUTABLE_OUTPUT_PATH
    • Set this variable to specify where executables should be placed (instead of CMAKE_CURRENT_BINARY_DIR)
    • SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
  • LIBRARY_OUTPUT_PATH
    • Set this variable to specify where libraries should be placed (instead of CMAKE_CURRENT_BINARY_DIR)
    • SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
  • PROJECT_NAME
    • The name of the project set by the project() command
  • PROJECT_SOURCE_DIR
    • Full path to the root of your project source directory (nearest directory where CMakeLists.txt contains the project() command

Change Log

  • 20190909:
    • Added additional CMake resources recommended through the Embedded.fm Slack Group
    • Added a Videos section
    • Added a Project Skeletons section
    • Added a Table of Contents