[Qt-creator] qmake question

Kevin Krammer kevin.krammer at kdab.com
Tue Jan 28 10:21:32 CET 2014


On Monday, 2014-01-27, 18:45:15, Mohammad Mirzadeh wrote:
> Hi guys,
> 
> This is not strictly a QtCreator question so please excuse me if this is
> the wrong mailing list.
> 
> Is there any way to ask qmake to check if a given function is defined
> inside a system hear file during the configuration step, a.k.a. running
> qmake?

You can make configure-style tests

in your .pro file:

####
# configure style tests
# QMAKE_CONFIG_TESTS_DIR defaults to dir of current .pro files + config.tests
# sets config_$test if successful
# e.g. config_cpp11 for test config.tests/cpp11

load(configure)

log($${EOL}Running configure tests...$${EOL}$${EOL})
CONFIG_TESTS = $$files($$QMAKE_CONFIG_TESTS_DIR/*.pro, true)
for(test, CONFIG_TESTS) {
    test = $$basename(test)
    test ~= s/\\.pro$//
    qtCompileTest($$test)
}

contains(CONFIG, config_cpp11) {
   # do C++11 things
}

in a sub directory config.tests add directories that contain small test 
programs. They will be built and run.
In your case only the building matters, i.e. include the system header and 
call the function or try to get its address.

Cheers,
Kevin

-- 
Kevin Krammer | kevin.krammer at kdab.com | Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - Qt Experts - Platform-independent software solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5918 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20140128/f873ead5/attachment.bin>


More information about the Qt-creator mailing list