Recent

Author Topic: Is there any macro giving current version number  (Read 7137 times)

sinfoni

  • Jr. Member
  • **
  • Posts: 56
Is there any macro giving current version number
« on: July 08, 2010, 04:28:56 pm »
Hi all,

I wonder if there is a macro able to get the current version/build number of a project, like $(ProjOutDir), $(TargetCPU), $(TargetOS) and so o.
I've searched in wiki without success.

If yes, is there anyway to use this kind of macro in code. The goal is to write a function able to return the current version of the binary, that is something like that:

Code: [Select]
function Ver: String;
begin
    result := $(ProjVer);
end;

My project is under Mac OS X, and unix binaries can not include executable version as  Windows binaries.

Any idea ?

thanks,
André.
« Last Edit: July 08, 2010, 04:37:29 pm by sinfoni »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4542
  • I like bugs.
Re: Is there any macro giving current version number
« Reply #1 on: July 08, 2010, 04:40:22 pm »
Any idea ?

You can create such macro or const definition inside your project.
One way to make your program to show that info is to use a command line parameter. For example:
Code: [Select]
MyProg --version

and then the program would only output the version info to STDOUT and nothing else.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

sinfoni

  • Jr. Member
  • **
  • Posts: 56
Re: Is there any macro giving current version number
« Reply #2 on: July 08, 2010, 05:05:18 pm »
Yes, of course, but I would to use the Lazarus incremental version functionnality: Each time you build the project, the build version is automatically incremented. If I use constants (That's the way I do it now), I have to manually set these constants...

Can I create my own macro ?

eny

  • Hero Member
  • *****
  • Posts: 1646
Re: Is there any macro giving current version number
« Reply #3 on: July 08, 2010, 05:44:58 pm »
I think in theory you can enable Version Info (Project Options/Version Info).
But when I try this myself (XP, 0.9.29 build 26516) I get a spurious error message.
This has never worked out-of-the-box in any recent version as far as I know.
« Last Edit: July 08, 2010, 05:49:14 pm by eny »
All posts based on: Win10 (Win64); Lazarus 3_4  (x64) 25-05-2024 (unless specified otherwise...)

sinfoni

  • Jr. Member
  • **
  • Posts: 56
Re: Is there any macro giving current version number
« Reply #4 on: July 08, 2010, 06:06:13 pm »
Yes, Version Info is Enable. But Mac OS X is Unix based, and Unix binaries can not include version info. So... I tried to put version info using my own function which use Lazarus version Info. So, how access to Lazarus Version Info ? That's the question. 

Leledumbo

  • Hero Member
  • *****
  • Posts: 8783
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Is there any macro giving current version number
« Reply #5 on: July 09, 2010, 09:18:01 am »
Quote
Unix binaries can not include version info
Not in lazarus territory AFAIK. It's just the cross platform API to read it is still in development (could anyone please confirm this?)

 

TinyPortal © 2005-2018