Reputation: 570
My Qt5 program needs to use one enum if the version of the ALSA library which it is dependent on is less than a certain value, and a different enum if the version is greater than or equal to that value. Is it possible for qmake to check for the version of that library and to set a define that I can use to set the proper enum expression?
Upvotes: 1
Views: 166
Reputation: 98425
It's possible but unnecessary. Your question is yet another X-Y problem: all you want is to check the version of ALSA library. qmake doesn't figure anywhere in it, right?
All you want is:
#include <alsa/version.h>
#if SND_LIB_VERSION >= 0x010005
// 1.0.5 and later
enum { FOO = 42 };
#else
// 1.0.4 and earlier
enum { FOO = 101010 };
#endif
Even better, in modern C++ you can ensure that your code won't bit-rot:
int constexpr kFoo() {
return (SND_LIB_VERSION >= 0x010005) ? 42 : 101010;
}
Upvotes: 1