cmake_minimum_required.rst 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. cmake_minimum_required
  2. ----------------------
  3. Set the minimum required version of cmake for a project.
  4. ::
  5. cmake_minimum_required(VERSION major.minor[.patch[.tweak]]
  6. [FATAL_ERROR])
  7. If the current version of CMake is lower than that required it will
  8. stop processing the project and report an error. When a version
  9. higher than 2.4 is specified the command implicitly invokes
  10. ::
  11. cmake_policy(VERSION major[.minor[.patch[.tweak]]])
  12. which sets the cmake policy version level to the version specified.
  13. When version 2.4 or lower is given the command implicitly invokes
  14. ::
  15. cmake_policy(VERSION 2.4)
  16. which enables compatibility features for CMake 2.4 and lower.
  17. The ``FATAL_ERROR`` option is accepted but ignored by CMake 2.6 and
  18. higher. It should be specified so CMake versions 2.4 and lower fail
  19. with an error instead of just a warning.
  20. .. note::
  21. Call the ``cmake_minimum_required()`` command at the beginning of
  22. the top-level ``CMakeLists.txt`` file even before calling the
  23. :command:`project` command. It is important to establish version
  24. and policy settings before invoking other commands whose behavior
  25. they may affect. See also policy :policy:`CMP0000`.
  26. Calling ``cmake_minimum_required()`` inside a :command:`function`
  27. limits some effects to the function scope when invoked. Such calls
  28. should not be made with the intention of having global effects.