ENVIRONMENT_MODIFICATION.rst 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ENVIRONMENT_MODIFICATION
  2. ------------------------
  3. .. versionadded:: 3.22
  4. Specify environment variables that should be modified for running a test. Note
  5. that the operations performed by this property are performed after the
  6. :prop_test:`ENVIRONMENT` property is already applied.
  7. Set to a :ref:`semicolon-separated list <CMake Language Lists>` of
  8. environment variables and values of the form ``MYVAR=OP:VALUE``,
  9. where ``MYVAR`` is the case-sensitive name of an environment variable
  10. to be modified. Entries are considered in the order specified in the
  11. property's value. The ``OP`` may be one of:
  12. - ``reset``: Reset to the unmodified value, ignoring all modifications to
  13. ``MYVAR`` prior to this entry. Note that this will reset the variable to
  14. the value set by :prop_test:`ENVIRONMENT`, if it was set, and otherwise
  15. to its state from the rest of the CTest execution.
  16. - ``set``: Replaces the current value of ``MYVAR`` with ``VALUE``.
  17. - ``unset``: Unsets the current value of ``MYVAR``.
  18. - ``string_append``: Appends singular ``VALUE`` to the current value of
  19. ``MYVAR``.
  20. - ``string_prepend``: Prepends singular ``VALUE`` to the current value of
  21. ``MYVAR``.
  22. - ``path_list_append``: Appends singular ``VALUE`` to the current value of
  23. ``MYVAR`` using the host platform's path list separator (``;`` on Windows
  24. and ``:`` elsewhere).
  25. - ``path_list_prepend``: Prepends singular ``VALUE`` to the current value of
  26. ``MYVAR`` using the host platform's path list separator (``;`` on Windows
  27. and ``:`` elsewhere).
  28. - ``cmake_list_append``: Appends singular ``VALUE`` to the current value of
  29. ``MYVAR`` using ``;`` as the separator.
  30. - ``cmake_list_prepend``: Prepends singular ``VALUE`` to the current value of
  31. ``MYVAR`` using ``;`` as the separator.
  32. Unrecognized ``OP`` values will result in the test failing before it is
  33. executed. This is so that future operations may be added without changing
  34. valid behavior of existing tests.
  35. The environment changes from this property do not affect other tests.