Integrating with CMake

On non-Windows systems, you can translate projects that are built with CMake by incorporating a JSON compilation database in the OpenText SAST command. This is only supported for Makefile and Ninja generators (see the CMake Reference Documentation for more information).

To integrate OpenText SAST with a CMake build:

  1. Generate a compile_commands.json file for your CMake project.

    Add -DCMAKE_EXPORT_COMPILE_COMMANDS=yes to the cmake configure command. For example:

     cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=yes
  2. Include the JSON compilation database in your sourceanalyzer command as follows:

    sourceanalyzer -b <build_id> compile_commands.json