ENVIRONMENT_MODIFICATION.rst 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 ``VALUE`` to the current value of ``MYVAR``.
  19. - ``string_prepend``: Prepends ``VALUE`` to the current value of ``MYVAR``.
  20. - ``path_list_append``: Appends ``VALUE`` to the current value of ``MYVAR``
  21. using the host platform's path list separator (``;`` on Windows and ``:``
  22. elsewhere).
  23. - ``path_list_prepend``: Prepends ``VALUE`` to the current value of
  24. ``MYVAR`` using the host platform's path list separator (``;`` on Windows
  25. and ``:`` elsewhere).
  26. - ``cmake_list_append``: Appends ``VALUE`` to the current value of ``MYVAR``
  27. using ``;`` as the separator.
  28. - ``cmake_list_prepend``: Prepends ``VALUE`` to the current value of
  29. ``MYVAR`` using ``;`` as the separator.
  30. Unrecognized ``OP`` values will result in the test failing before it is
  31. executed. This is so that future operations may be added without changing
  32. valid behavior of existing tests.
  33. The environment changes from this property do not affect other tests.