This topic explains how to add a definition for your cross-compiler to C++test so that you can use it in all projects which you normally compile with this compiler.

Sections include:

Understanding When to Add a Custom Compiler Definition

In general, a custom compiler should be defined when:

By defining a custom compiler, you can modify compiler/linker names and the specific patterns for how C++test uses the compiler and linker.

Adding a Custom Compiler Definition

Different approaches to adding custom compiler definitions are recommended for different C++test installation scenarios:

Once you have a new definition of your custom compiler, you can use it in all projects that you normally compile with this compiler. When we discuss "building the test harness for target platform," it is assumed that you are using the suitable compiler definition. This is a part of defining the test flow.

To add a custom compiler definition to C++test.

  1. (Optional) If you want to specify the location of the custom compiler definition files, choose Parasoft> Preferences, select Parasoft> Configurations, then enable Custom directories> Custom compilers  and enter the location in the appropriate field .
  2. Choose File> New> Other, choose C++test> Custom compiler, then click Next.The New Custom Compiler dialog will open.

  3. Select Add custom compiler, then click Next.

  4. In the next page, specify the following custom compiler settings:

  5. (Optional) If you want to see the paths to configuration files created for your new custom compiler, click Next.

  6. Click Finish.

When a new compiler definition is added, C++test creates a set of configuration files which can be customized. These files include:

Importing Custom Compiler Definitions

Any custom compiler definitions that are available in the designated Custom Compilers location will be loaded automatically upon startup, and available for use. Thus, one way to "import" definitions is to save them in the Custom Compiler location. By default, the custom compiler definition files are saved in<workspace>\.metadata\.plugins\com.parasoft.xtest.checkers.eclipse.core.cpp/compilers.To change this location, choose Parasoft> Preferences, select Parasoft> Configurations, then enable Custom directories> Custom compilers  and enter the location in the appropriate field .

To import a custom compiler definition that is stored in another location:

  1. Choose File> New> Other, choose C++test> Custom compiler, then click Next. The New Custom Compiler dialog will open.

  2. Select Import custom compiler, then click Next.
  3. In the Base compiler definition directory field, specify the directory which contains the compiler definition files (described in the previous section) that you want to import.
  4. Click Finish.

Setting Build Options

After adding a custom compiler, ensure that your Project Options’ Build Settings are set properly:

  1. Load (or create) the C++test project in the GUI.
  2. In the project tree, right-click the project node, then choose Properties from the shortcut menu.

  3. In the Properties panel, expand the Parasoft> C++test category and select Build Settings.
  4. From the Compiler settings> Family box, select the name of your custom compiler.
  5. Add the library that you built with the custom compiler to the linker options by changing the Linker options. For example, you might change it from
    ${cpptest:original_options}
    to
    ${cpptest:original_options} "C:\cygwin\home\<user_name>\Custom_Compiler\source\target\libcpptestruntime.a"
  6. Click Apply, then OK.

Tips

  • The compiler family setting should correspond to the name of the actual compiler.
  • The compiler and linker settings should be set for your environment, and should be consistent.
  • For Managed Make projects, compiler and linker settings are specified in the managed project settings.
  • See Configuring Project and File Options for details on reviewing and setting project options.