Introduction to cmake

raphaelmeyer
29.6K views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

You did it!

Some Final Words

Does:

  • Use the commands
    • target_include_directories
    • target_link_libraries
    • target_compile_definitions
    • target_compile_features
    • target_compile_options
  • Always set cmake_minimum_required
  • Use PRIVATE, INTERFACE and PUBLIC
  • Use namespaced alias targets

Don'ts:

  • Do NOT use
    • add_compile_options
    • add_definitions
    • include_directories
    • link_directories
    • link_libraries
  • Never ever use set(CMAKE_...)

Resources

Effective CMake by Daniel Pfeifer at C++Now 2017

Using Modern CMakePatterns to Enforce a Good Modular Design by Mathieu Ropert

Embracing Modern CMake by Stephen Kelly

Open Source Your Knowledge: become a Contributor and help others learn. Create New Content