premake/website/docs/files.md
2021-03-12 22:10:24 +01:00

1.3 KiB

Adds files to a project.

files { "file_list" }

Parameters

file_list specifies one or more file patterns. File paths should be specified relative to the currently executing script file. File patterns may contain the * wildcard to match against files in the current directory, or the ** wildcard to perform a recursive match.

If a wildcard matches more files than you would like, you may filter the results using the removefiles() function.

Applies To

Project configurations. Not all exporters currently support per-configuration file lists however.

Examples

Add two files from to the current project, from the same directory that contains the script.

files { "hello.cpp", "goodbye.cpp" }

Add all C++ files from the src/ directory to the project.

files { "src/*.cpp" }

Add all C++ files from the src/ directory and any subdirectories.

files { "src/**.cpp" }

Add files for specific systems; might not work with all exporters.

filter "system:Windows"
  files { "src/windows/*.h", "src/windows/*.cpp" }

filter "system:MacOSX"
  files { "src/mac/*.h", "src/mac/*.cpp" }

See Also