get_test_property.rst 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. get_test_property
  2. -----------------
  3. Get a property of the test.
  4. .. code-block:: cmake
  5. get_test_property(test property [DIRECTORY <dir>] VAR)
  6. Get a property from the test. The value of the property is stored in
  7. the variable ``VAR``. If the test property is not found, the behavior
  8. depends on whether it has been defined to be an ``INHERITED`` property
  9. or not (see :command:`define_property`). Non-inherited properties will
  10. set ``VAR`` to "NOTFOUND", whereas inherited properties will search the
  11. relevant parent scope as described for the :command:`define_property`
  12. command and if still unable to find the property, ``VAR`` will be set to
  13. an empty string.
  14. For a list of standard properties you can type
  15. :option:`cmake --help-property-list`.
  16. .. versionadded:: 3.28
  17. Directory scope can be overridden with the following sub-option:
  18. ``DIRECTORY <dir>``
  19. The test property will be read from the ``<dir>`` directory's
  20. scope. CMake must already know about that source directory, either by
  21. having added it through a call to :command:`add_subdirectory` or ``<dir>``
  22. being the top level source directory. Relative paths are treated as
  23. relative to the current source directory. ``<dir>`` may reference a binary
  24. directory.
  25. See Also
  26. ^^^^^^^^
  27. * :command:`define_property`
  28. * the more general :command:`get_property` command