how to pass a rpm spec parameter to C++ program

2019-08-16 09:27发布

let's assume that we have a rpm .spec file with following parameter:

Version:       0.1.0

I want to pass this parameter to C++ code from the same package, i.e. I would like to initialize with this value a C++ variable:

const std::string program_version([here goes 0.1.0 read from the .spec file]);

I am using cmake and I suppose that first step would be (in .spec file):

%cmake . -DVERSION=%{version}

Any hints? Thank you in advance ;>

标签: c++ cmake rpm
0条回答
登录 后发表回答