Tips About Using Cmake

I have used Makefile for more than 3 years, and I like to use it for its easy-to-use. But I have to learn how to use Cmake(I hate this) due to my project is based on OpenCV, which based on Cmake when compiling. So I will write some tips/hints for myself:

  1. Basic functions

    1
    2
    3
    4
    5
    6
    #
    cmake_minimum_required(VERSION 2.8) # Required version for Cmake
    project(XXX) # project name
    add_executable(XXX) # compile
  2. Multi-files & multi-dirs

    1
    # TODO
  3. Define compile options

    1
    # TODO
  4. Add dependencies and testers

    1
    # TODO
  5. Miscellaneous

    1
    # TODO