8.4.3. Local Analyses with CMake and Eclipse¶
8.4.3.1. Background¶
Your project is built using CMake and you are using the Eclipse IDE with the Axivion Eclipse Plugin.
8.4.3.2. What can be configured?¶
You can set up:
analysis of your project on your local development machine, in contrast to the analysis on the CI server
analysis of a single file and display of warnings in Eclipse
8.4.3.3. What needs to be done?¶
The recommended approach to set up Local Build and Single File Analysis is:
Using
CMake, set up a separate out-of-source build tree with one of the generators forGNU makeor forninja. See CMake for details.Specify
-DCMAKE_EXPORT_COMPILE_COMMANDS=1when callingCMake(or putset(CMAKE_EXPORT_COMPILE_COMMANDS Yes)inside yourCMakeconfiguration files) to have it generate a filecompile_commands.jsonthat can be used to re-run the compilation of a single unit.Install the Axivion Eclipse Plugin (follow instructions in Eclipse Plugin). Make sure to configure
BAUHAUS_CONFIGin the project settings to point to your project configuration. This will select the compiler profile and the set of stylechecks to be run.Follow the instructions for the Eclipse Plugin’s Makefile Integration to set up the single-file analysis:
Enable “Make Command for Single File” (using the checkbox on the right).
“Build Working Directory”: set this to the same directory as the option /Project/directory configured in
axivion_config.(Note: use Eclipse variables to specify this relative to, e.g., the root directory of the Eclipse project, such as
${project_loc}/..).“Source Basepath”: use the same value as for “Build Working Directory”.
Configure “Make Command for Single File” to:
build_compile_commands --single_file ${axivion_ir_file}.${axivion_src_ext} <path-to-build-tree>/compile_commands.jsonusing the
CMake-generated out-of-source build directory as<path-to-build-tree>(this can be relative to the “Build Working Directory”).