Getting Started with CMake: Helpful Resources

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.

Learning CMake

Cheat Sheets

Documentation

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