[Cmake] some starting help wanted :-)
Alexander Neundorf
a.neundorf-work at gmx.net
Thu, 29 Apr 2004 16:49:16 +0200 (MEST)
This is a MIME encapsulated multipart message -
please use a MIME-compliant e-mail program to open it.
Dies ist eine mehrteilige Nachricht im MIME-Format -
bitte verwenden Sie zum Lesen ein MIME-konformes Mailprogramm.
--========GMXBoundary124011083250156
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
> Alexander Neundorf wrote:
> > Hi,
> >
> > until now I used only some basic functions of cmake, now I want to do
> > something more with it, i.e. try to add better support for Qt and KDE.
> >
> > 1) There is a FindQt file, which searches for libqt. Now I'd like to
> > improve it this way that I can specify which version of Qt I need at
> least
> > and whether I need the multithreaded version of Qt or not.
>
> You could modify the file to look for a QT_REQUIRED_VERSION variable and
> use its contents to check for a particular version.
Ok, here is a first try.
In CMakeLists.txt you can set
SET(QT_MT_REQUIRED TRUE)
if you need the multithreaded Qt version.
You can also set
SET(QT_MIN_VERSION "3.2.0")
if you require a minimum version of Qt.
It also tries to compile and run a very small Qt app.
The version checking wasn't quite easy. In qglobal.h there is a
QT_VERSION_STR
defined. But how should I compare this to the value specified in
QT_MIN_VERSION ?
The only way I found so far was to write the attached file
CheckForQtMinVersion.cpp.in, where cmake replaces a placeholder with the
specified
minimum version, and which compares this version with the one from
qglobal.h. Seems to
me quite complicated. I also wanted to do something with awk, but this
doesn't exist
under Win, so I guess I can't use it.
I had also some problems with getting TRY_COMPILE and TRY_RUN to work. Is
there a way
to get the used compile command and the error and warning messages ? I
couldn't find
them anywhere.
What do you think ? Is it on the right track or am I completely off ?
Bye
Alex
--
NEU : GMX Internet.FreeDSL
Ab sofort DSL-Tarif ohne Grundgebühr: http://www.gmx.net/dsl
--========GMXBoundary124011083250156
Content-Type: text/plain; name="FindQtX.cmake"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="FindQtX.cmake"
IyBMb2NhdGUgUXQgaW5jbHVkZSBwYXRocyBhbmQgbGlicmFyaWVzDQoN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==
--========GMXBoundary124011083250156
Content-Type: text/x-csrc; name="CheckForQtMinVersion.cpp.in"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="CheckForQtMinVersion.cpp.in"
I2luY2x1ZGUgPHFnbG9iYWwuaD4NCiNpbmNsdWRlIDxxc3RyaW5nbGlzdC5oPg0KDQppbnQgbWFp
bihpbnQgYXJnYywgY2hhcioqIGFyZ3YpDQp7DQogICBRU3RyaW5nTGlzdCBpc1NsPVFTdHJpbmdM
aXN0OjpzcGxpdCgnLicsIFFUX1ZFUlNJT05fU1RSKTsNCg0KICAgUVN0cmluZ0xpc3QgcmVxU2w9
UVN0cmluZ0xpc3Q6OnNwbGl0KCcuJywgIiR7UVRfTUlOX1ZFUlNJT059Iik7DQogICBpZiAoKGlz
U2wuY291bnQoKSE9MykgfHwgKHJlcVNsLmNvdW50KCkhPTMpKQ0KICAgICAgcmV0dXJuIDE7DQoN
CiAgIGlmIChyZXFTbFswXS50b1VJbnQoKSA+IGlzU2xbMF0udG9VSW50KCkpDQogICAgICByZXR1
cm4gMjsNCiAgIGVsc2UgaWYgKHJlcVNsWzBdLnRvVUludCgpIDwgaXNTbFswXS50b1VJbnQoKSkN
CiAgICAgIHJldHVybiAwOw0KDQovL21ham9yIGlzIGVxdWFsDQogICBpZiAocmVxU2xbMV0udG9V
SW50KCkgPiBpc1NsWzFdLnRvVUludCgpKQ0KICAgICAgcmV0dXJuIDM7DQogICBlbHNlIGlmIChy
ZXFTbFsxXS50b1VJbnQoKSA8IGlzU2xbMV0udG9VSW50KCkpDQogICAgICByZXR1cm4gMDsNCg0K
Ly9taWRkbGUgaXMgZXF1YWwNCiAgIGlmIChyZXFTbFsyXS50b1VJbnQoKSA+IGlzU2xbMl0udG9V
SW50KCkpDQogICAgICByZXR1cm4gNDsNCg0KICAgcmV0dXJuIDA7DQp9DQo=
--========GMXBoundary124011083250156
Content-Type: text/x-c++src; name="CheckForQt.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="CheckForQt.cpp"
I2luY2x1ZGUgPHFhcHBsaWNhdGlvbi5oPg0KDQppbnQgbWFpbihpbnQgYXJnYywgY2hhcioqIGFy
Z3YpDQp7DQogICBRQXBwbGljYXRpb24gYShhcmdjLCBhcmd2KTsNCiAgIHJldHVybiAxOw0KfQ==
--========GMXBoundary124011083250156--