Understand has many options for generating accurate projects. Accurate projects help leverage the full potential of the C/C++ Strict parser. Buildspy actively constructs the Understand database by directly modifying the project. As an alternative, most build systems have the capability to save their compile commands to a log file. There are several of those logging formats that Understand can read in order to create a project definition. The most robust are the compile_commands.json files that CMAKE generates. These have all of the same information that Buildspy captures, making them useful for the Strict parser. The main difference as far as Understand is concerned, is that this information is saved to a text file instead of actively interacting with the Understand Project like Buildspy. When creating a new project in the Project Wizard, you will first be asked for the directory where your source is located. If there is a compile_commands.json file in this directory, you will be given an option to Import that file in order to make your project.



The option is also available with our command line tool Und using the add command.


( und -db path/to/db.udb create -languages C++ add path/to/build/dir/compile_commands.json               settings -c++AddFoundFilesToProject on analyze )


Every time the code is compiled, the json file is automatically updated by the build system – with no impact on Understand. Then in the user’s Understand project, you can hit Analyze and that json file is scanned for changes and, if there are any, the project is reanalyzed. No opening or closing of Understand is needed. 


Up until recently this option was only available to projects built with CMAKE, but we found an open source project named BEAR that generates the same json files for non-CMAKE build systems. It has been tested and works great. Please note, that when using BEAR, the file needs to be named compile_commands.json.