Reusing unit paths across build modes lazarus / 13-General ---------------------------------------------------------------------- Чебурашка · 2023-11-26 13:00 Hi, it happened to me several times that I have 2/3 Lazarus build modes, and I need to modify the unit paths (-Fu) to include additional stuff. The problem is that I have to make it manually in each build mode every time, and of course I do mistakes almost always. Of course it is senseful to have different unit paths depending on the build mode, for example to include extra units related to debugging, but I would like to know if is possible to "import" or "refer to" the unit path of another build mode, so that in case I need modify I can make it in the "principal" build bode, an the modification is reflected automatically in other ones. ---------------------------------------------------------------------- n7800 · 2023-12-24 03:08 Unfortunately, Lazarus does not yet support "inheritance" of build modes. But I can offer you alternatives: 1) Use conditional compilation: https://wiki.freepascal.org/Conditional_compilation You can define "symbols" for each build mode by clicking on the "Defines..." button in this options section: https://wiki.freepascal.org/IDE_Window:_Compiler_Options#Custom_Option s This will allow certain parts of the code to only compile in specified build profiles: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FormCreate(Sender: TObject);begin  {$IFDEF DebugBuild}  ShowMessage('This message will only be shown in debug build mode');  {$ENDIF}end; 2) If you want to specify different units in each build mode, then use conditional compilation directly in the "uses" section: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  Classes, SysUtils {$IFDEF DebugBuild}, MyDebugUnit{$ENDIF}; 3) Or you can use the following compiler directive: https://www.freepascal.org/docs-html/prog/progsu119.html Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$IFDEF ReleaseBuild}  {$UNITPATH ​units\release}{$ELSE}  {$UNITPATH ​units\debug}{$ENDIF} uses  Classes, SysUtils, MyUnit; 4) The same link (at the end of the page) provides another method via: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  Classes, SysUtils,  {$IFDEF ReleaseBuild}  MyUnit in 'units\release\MyUnit.pas'  {$ELSE}  MyUnit in 'units\debug\MyUnit.pas'  {$ENDIF}  ; Read the warnings about relative paths carefully.