Only enable the automoc test after checking that Qt4 works

On some systems which contribute nightly builds there were strange
errors which seemed to hint that the installed Qt4 is not usable/
not usable with this compiler. So first check whether it works,
and only if this was successful, enable the test.

Alex
This commit is contained in:
Alex Neundorf 2011-08-18 00:16:02 +02:00
parent 71c29d11b3
commit 678e124481
1 changed files with 31 additions and 12 deletions

View File

@ -845,18 +845,37 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
ENDIF(NOT QT4_FOUND) ENDIF(NOT QT4_FOUND)
IF(QT4_FOUND) IF(QT4_FOUND)
ADD_TEST(QtAutomoc ${CMAKE_CTEST_COMMAND} # test whether the Qt4 which has been found works, on some machines
--build-and-test # which run nightly builds there were errors like "wrong file format"
"${CMake_SOURCE_DIR}/Tests/QtAutomoc" # for libQtCore.so. So first check it works, and only if it does add
"${CMake_BINARY_DIR}/Tests/QtAutomoc" # the automoc test.
--build-generator ${CMAKE_TEST_GENERATOR} INCLUDE(CheckCXXSourceCompiles)
--build-project QtAutomoc SET(_save_CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} SET(_save_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
--build-exe-dir "${CMake_BINARY_DIR}/Tests/QtAutomoc"
--force-new-ctest-process SET(CMAKE_REQUIRED_INCLUDES ${QT_INCLUDES})
--test-command ${CMAKE_CTEST_COMMAND} -V SET(CMAKE_REQUIRED_LIBRARIES ${QT_QTCORE_LIBRARIES})
)
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomoc") CHECK_CXX_SOURCE_COMPILES("#include <QCoreApplication>\n int main() {return (qApp == 0 ? 0 : 1); }\n"
QT4_WORKS_FOR_AUTOMOC_TEST)
SET(CMAKE_REQUIRED_INCLUDES "${_save_CMAKE_REQUIRED_INCLUDES}")
SET(CMAKE_REQUIRED_LIBRARIES "${_save_CMAKE_REQUIRED_LIBRARIES}")
IF(QT4_WORKS_FOR_AUTOMOC_TEST)
ADD_TEST(QtAutomoc ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/QtAutomoc"
"${CMake_BINARY_DIR}/Tests/QtAutomoc"
--build-generator ${CMAKE_TEST_GENERATOR}
--build-project QtAutomoc
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-exe-dir "${CMake_BINARY_DIR}/Tests/QtAutomoc"
--force-new-ctest-process
--test-command ${CMAKE_CTEST_COMMAND} -V
)
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomoc")
ENDIF()
ENDIF() ENDIF()
ADD_TEST(ExternalProject ${CMAKE_CTEST_COMMAND} ADD_TEST(ExternalProject ${CMAKE_CTEST_COMMAND}