Compiler Options are not working properly in 12.3

Could someone else please confirm.

I have a project group with common files between projects. Shared files have different code depending on if it is for the server or the client.

In project compiler options I define a symbol say TMSWEB for the client and I have code such as

{$ifdef TMSWEB}
Client Code
{$else}
Server Code
{$endif}

For the server, it compiles fine as TMSWEB is not defined. For the client (even if I do a build), it does not find TMSWEB defined and tries to compile incorrect code.

Hmm… I suspect your configuration conditional define has something wrong :thinking:


1 Like

Does pas2js actually cope with compiler defines and does it see them from the project options? Can you try and do the define in code and see what happens?

1 Like

I had reported it on TMS support and I was led to believe that it would work. So, I had started suspecting 12.3.

However, you are correct. PAS2JS does not support the project level define. It works fine it if defined in code… But that’s of no use to me.

Thanks for trying it out. It helped to rule things out.

I hadn’t spotted the Compiler directive in the TMS Webcore portion.

If I set say FORWEB in
Options-> TMS Web → Compile → Directives,
then PAS2JS is happy.

If I set FORWEB it in
Options → Building → Delphi Compiler → Conditional Defines,
then the LSP is happy.

For best results, I have to put it in both. This is for Delphi 12.3. Other versions may behave differently.

1 Like

When using the TMS Web, do you mean the Tools > Options has a TMS Web section ?

Yes, that’s exactly what he means…

1 Like