Exclude code and refine the externals
- Introduction
- Exclude third party sources.
- Move code from my code to external projects.
- Move code from external projects to my code.
- Group external symbols in a lib.
Introduction
CppDepend automatically analyzes your code base, distinguishing between your code and external symbols. However, sometimes it's necessary to manually adjust this by excluding certain parsed sources from your project when they are part of a third-party library. This involves reclassifying some symbols, moving them from your code to external projects or vice versa, to ensure a more accurate representation in CppDepend's analysis.
Exclude third party sources.
When your project includes a third-party library as source code, CppDepend may recognize these files as part of your project. To address this, you can exclude these specific source files by navigating to "Project Properties -> Code To Analyze -> Exclude Projects, Folders and Files" in CppDepend. This allows for more accurate analysis by omitting the third-party library files from consideration.
Several exclusion options are offered, including:
- Exclude projects: Remove an entire project by its name.
- Exclude folders: Omit an entire folder.
- Exclude files: Exclude specific files individually.
- Exclude using Regex path: Utilize Regex paths for flexible exclusion of files or folders.
Transfer code from your own project to external projects.
If CppDepend mistakenly identifies external symbols as part of your code, you can reassign them to an external library by following a specific set of steps. This process involves adjusting the categorization within CppDepend to ensure that these symbols are correctly associated with external libraries rather than your own code base:
- Initiate the ProjectMaker tool, accessible through the Tools Menu in CppDepend.
- Choose the "AddProject" option and name the new project identically to your existing project that you wish to refine.
- Proceed by incorporating the include files you want to classify as external in the next step.
- To complete the process, add the .sl file created by the Project Maker. You can do this by going to "Project Properties->Code To Analyze" and then selecting "Add build specification generated by project maker."
Relocate code from external libraries to your own project
If CppDepend classifies some of your code's symbols as external, you can realign them back to your code by following a specific set of instructions. This process involves modifying the categorization within CppDepend to ensure these symbols are appropriately recognized as part of your project.
- Start the ProjectMaker tool from the CppDepend Tools Menu to begin the process.
- Choose the "AddProject" function and assign it the same name as the project you are looking to enhance.
- Within the project properties, ensure to select the option "Is this project external".
-
The subsequent step involves incorporating the include files that you want to be recognized as part of your code.
-
Lastly, include the .sl file that the Project Maker generated into your project. This can be done by going to "Project Properties->Code To Analyze" and then selecting the option to "Add build specification generated by project maker."
Consolidate external symbols into a single library
Following the analysis of your projects, you might find that some external symbols are grouped in a default external project labeled as "Externals".
To better organize external symbols and assign them to their respective external projects rather than a generic one, you can follow these steps:
- Firstly, create a project as previously described.
- Then, add the directory containing the library's include files to this project.
- In the project properties, make sure to select the option that indicates "This project is external".
-
Finally, incorporate the .sl file generated by the Project Maker. You can do this by navigating to "Project Properties -> Code To Analyze" and then choosing the option to "Add build specification generated by project maker".
This process will help in organizing and accurately categorizing external symbols for your project.