Skip to content
Jason Perkins edited this page May 8, 2015 · 11 revisions

The files function adds files to a project.

files { "file_list" }

If a project includes multiple calls to files() the lists are concatenated, in the order in which they appear in the script.

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

Files may be specified at the solution, project, or configuration level. 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

Clone this wiki locally