get_directory_property.rst 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. get_directory_property
  2. ----------------------
  3. Get a property of ``DIRECTORY`` scope.
  4. .. code-block:: cmake
  5. get_directory_property(<variable> [DIRECTORY <dir>] <prop-name>)
  6. Stores a property of directory scope in the named ``<variable>``.
  7. The ``DIRECTORY`` argument specifies another directory from which
  8. to retrieve the property value instead of the current directory.
  9. It may reference either a source directory, or since CMake 3.19,
  10. a binary directory. Relative paths are treated as relative to the
  11. current source directory. CMake must already know about the directory,
  12. either by having added it through a call to :command:`add_subdirectory`
  13. or being the top level directory.
  14. If the property is not defined for the nominated directory scope,
  15. an empty string is returned. In the case of ``INHERITED`` properties,
  16. if the property is not found for the nominated directory scope,
  17. the search will chain to a parent scope as described for the
  18. :command:`define_property` command.
  19. .. code-block:: cmake
  20. get_directory_property(<variable> [DIRECTORY <dir>]
  21. DEFINITION <var-name>)
  22. Get a variable definition from a directory. This form is useful to
  23. get a variable definition from another directory.
  24. See also the more general :command:`get_property` command.