How it works

In steps 4 and 5, we set a number of properties for the animals and animal-farm targets:

  • CXX_STANDARD mandates the standard that we would like to have.
  • CXX_EXTENSIONS tells CMake to only use compiler flags that will enable the ISO C++ standard, without compiler-specific extensions.
  • CXX_STANDARD_REQUIRED specifies that the version of the standard chosen is required. If this version is not available, CMake will stop configuration with an error. When this property is set to OFF, CMake will look for next latest version of the standard, until a proper flag has been set. This means to first look for C++14, then C++11, then C++98.
At the time of writing, there is no Fortran_STANDARD property available yet, but the standard can be ...

Get CMake Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.