You mean this?
program Project1;
begin
{$ifdef cpuI386}
writeln('Intel/amd 32 bit');
{$endif}
{$ifdef cpux64}
writeln('Intel/amd 32 bit' );
{$endif}
end.
Depending on the cpu, one of the two lines will be greyed in the Lazarus editor to show that particular code will not be compiled.
There are some preprocessors available that can do that for you: removing code from sources that will not be compiled based on a (set of) defines. For Delphi, I used DIPP in the past, but I also wrote one to parse KOL a long time ago.
I assume there are many more, e.g. based on Castalia or maybe fcl-passsrc.
Nowadays I leave everything in, though.
But that the IDE shows it, means it contains a define parser, so maybe you can lift that out.
If you do so, always make a backup, because it can and will make mistakes.
Delphi dipp is here:
https://www.yunqa.de/delphi/apps/dipp/indexAn alternative that can probably translated to FPC is ppp:
https://clootie.narod.ru/delphi/download_utils.html#ppp and comes with sourcecode. (The original is by Barry Kelly, a.k.a. the last known good compiler engineer at Embarcadero)
Can' t find my own parser back -Well, I can but it is on a BigFoot drive and I have no ide interface anymore - , but that is based on Castalia (ultimately TmwParser that Lazarus uses a descendant from)
All of these, except mine, are maintained.