FileOptions

The FileOptions element allows include paths, macros, and other compiler options to be specified for files with a particular extension. You can use FileOptions multiple times to specify different options for files with different extensions. For example, as shown below, if you have a project that contains both C and C++ files, create two FileOptions elements, one for each file type.

The following list describes the attributes for the FileOptions element:

  • extensions: String value. Semicolon-separated list of file extensions. Every file with an extension that matches an extension in this list acquires the options specified by this property. If a file extension applies to more than one occurrence of the FileOptions property, then the first occurrence in the Ounce Make properties file takes precedence.
  • compiler_options: String value. List of compiler options, separated by a space, to apply to all files with the specified extension. Do not specify include paths and macros here.
  • include_paths: String value. Semicolon-separated list of include paths to apply to all files with the specified extension.
  • macros: String value. Semicolon-separated list of macros to apply to all files with the specified extension.

Examples

The following FileOptions examples show how to configure the Ounce Make properties file to apply the correct options to both C and C++ files.

The FileOptions element with extensions="c" applies its other attribute values only to files with a c extension <filename.c>. The FileOptions element with extensions="cpp;cxx" will apply its other attribute values only to files with cpp (<filename.cpp>) or cxx (<filename.cxx>) extensions.

<!-- g++ options for C files -->
<FileOptions
	extensions="c"
	compiler_options="-gcc_linux_i386"
	include_paths="/usr/local/include;
	/usr/lib/gcc-lib/i386-redhat-linux/3.2.3/include;
	/usr/include"
	macros=""/>

<!-- g++ options for C++ files -->
	<FileOptions
	extensions="cpp;cxx"
	compiler_options="-g++_linux_i386"
	include_paths="/usr/include/c++/3.2.3;
	/usr/include/c++/3.2.3/i386-redhat-linux;
	/usr/include/c++/3.2.3/backward;/usr/local/include;
	/usr/lib/gcc-lib/i386-redhat-linux/3.2.3/include;
	/usr/include"
	macros="__GNUG__=3" />

Description

extensions="c" and extensions="cpp;cxx"

specifies the file extensions for which these file options apply.