Recent

Author Topic: Project settings: version info  (Read 1002 times)

piola

  • Full Member
  • ***
  • Posts: 154
  • Lazarus 2.2, 64bit on Windows 8.1 x64
Project settings: version info
« on: March 29, 2025, 06:34:25 pm »
Hello,

I do not really understand why the version info settings of a project are "global", i.e. independent of build modes. Imho, they (or at least some of them) should be specific to the build modes.

For example, the "debug" attribute is clearly related to the debug settings under "compiler options". All of them support build modes, but not the version info. This which means that I have to manually enable or disable the "debug" attribute, which is kind of error-prone.

Is there any other way to set the version info and enable particular version attributes? Maybe a compiler directive or a compiler switch, so that I can combine those with using build modes?

Thank you :)

n7800

  • Sr. Member
  • ****
  • Posts: 299
Re: Project settings: version info
« Reply #1 on: March 29, 2025, 09:58:20 pm »
I do not really understand why the version info settings of a project are "global", i.e. independent of build modes. Imho, they (or at least some of them) should be specific to the build modes.

Hello, at first glance it seems obvious. If it were so, the release version could be "1.2.0", and when changing to debug it could become "0.8". Even if you constantly update the version, it is just inconvenient and more prone to errors.

For example, the "debug" attribute is clearly related to the debug settings under "compiler options". All of them support build modes, but not the version info. This which means that I have to manually enable or disable the "debug" attribute, which is kind of error-prone.

Perhaps it would be worthwhile to include only the version "attributes" in the build mode? Although it would not be very obvious (why only part of the "version" belongs to the build modes), it would be possible.

But I am not sure how portable all these "flags" are between platforms. I tried to set "Debug" attribute on Windows now, and I can't find where to see it at all...

In practice, I am not sure that anyone uses it at all. For example, in theory, debug versions should not be distributed at all. Only developers should have them, or users should build them in order to get more information about the error (as Lazarus developers often ask for).

Is there any other way to set the version info and enable particular version attributes? Maybe a compiler directive or a compiler switch, so that I can combine those with using build modes?

As far as I know, Lazarus itself does not provide this option. But I have seen on the forum third party ways to do this (in a platform dependent way) that can be launched automatically by the IDE on every build.

piola

  • Full Member
  • ***
  • Posts: 154
  • Lazarus 2.2, 64bit on Windows 8.1 x64
Re: Project settings: version info
« Reply #2 on: March 30, 2025, 12:13:23 pm »
I tried to set "Debug" attribute on Windows now, and I can't find where to see it at all...

I'm using this piece of code which works very well:

Code: Pascal  [Select][+][-]
  1. uses fileinfo;
  2. var v: TVersionInfo = nil;
  3. begin
  4.     v := TVersionInfo.Create;
  5.     try
  6.         v.Load ('somefile.dll');
  7.         if (v.FixedInfo.FileFlags and v.FixedInfo.FileFlagsMask and VS_FF_DEBUG > 0) then ; // whatsoever
  8.     finally
  9.         FreeAndNil (v);
  10.     end;
  11. end;
  12.  

Quote
In practice, I am not sure that anyone uses it at all. For example, in theory, debug versions should not be distributed at all.

Yes, that's exactly why I'm using this flag: to help me keep track of what a development version is (actually, I'm using the "prerelease" flag for that, but it doesn't make a difference) and what is not. :D

Thank you for your response. I've already thought that there's probably no automatic way.

n7800

  • Sr. Member
  • ****
  • Posts: 299
Re: Project settings: version info
« Reply #3 on: March 30, 2025, 02:58:05 pm »
Yes, that's exactly why I'm using this flag: to help me keep track of what a development version is (actually, I'm using the "prerelease" flag for that, but it doesn't make a difference) and what is not. :D

Easier? I think the debug version is easy to spot by its huge size ))

piola

  • Full Member
  • ***
  • Posts: 154
  • Lazarus 2.2, 64bit on Windows 8.1 x64
Re: Project settings: version info
« Reply #4 on: March 30, 2025, 05:43:06 pm »
Not with "external symbols" enabled  ;)

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4570
  • I like bugs.
Re: Project settings: version info
« Reply #5 on: March 31, 2025, 09:53:14 am »
You can set "Target file name (-o)". For a debug version it could be "MyProject_debug" or similar.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018