set_source_files_properties.rst 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. set_source_files_properties
  2. ---------------------------
  3. Source files can have properties that affect how they are built.
  4. .. code-block:: cmake
  5. set_source_files_properties([file1 [file2 [...]]]
  6. [<TARGET_DIRECTORY ... | DIRECTORY ...>]
  7. PROPERTIES prop1 value1
  8. [prop2 value2 [...]])
  9. Sets properties associated with source files using a key/value paired
  10. list.
  11. Note that source file properties are by default visible only to
  12. targets added in the same directory (``CMakeLists.txt``).
  13. The file properties can be made visible in a different directory by specifying
  14. one of the additional options: ``TARGET_DIRECTORY`` or ``DIRECTORY``.
  15. ``DIRECTORY`` takes a list of processed directories paths, and sets the file
  16. properties in those directory scopes.
  17. ``TARGET_DIRECTORY`` takes a list of existing targets. The file
  18. properties will be set in these targets' directory scopes.
  19. See also the :command:`set_property(SOURCE)` command.
  20. See :ref:`Source File Properties` for the list of properties known
  21. to CMake. Source file properties are visible only to targets added
  22. in the same directory (``CMakeLists.txt``).