diff options
author | Stephen Kelly <stephen.kelly@kdab.com> | 2012-04-18 16:46:26 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-23 17:03:56 +0200 |
commit | 61c433785eb918d81b927f17bcad4687f2269afe (patch) | |
tree | bce4d94e963b4dd0f8fe73a19b5cd764a33b2627 /tests/auto/cmake/cmake.pro | |
parent | f88212c22f7e4bec261130a6f82294adfc75abca (diff) |
Move the CMake unit tests to auto/
This will allow the CI system to run the tests. The tests are only
run if cmake is found.
Change-Id: Ie73a56114c151871160bafcbf0b90b2d54620855
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Diffstat (limited to 'tests/auto/cmake/cmake.pro')
-rw-r--r-- | tests/auto/cmake/cmake.pro | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/auto/cmake/cmake.pro b/tests/auto/cmake/cmake.pro new file mode 100644 index 0000000000..9767914140 --- /dev/null +++ b/tests/auto/cmake/cmake.pro @@ -0,0 +1,50 @@ + +CMAKE_VERSION = $$system(cmake --version) + +# Cause make to do nothing. +TEMPLATE = subdirs + +check.commands = +isEmpty(CMAKE_VERSION) { + message("cmake executable not found. Not running CMake unit tests") +} else { + CTEST_VERSION = $$system(ctest --version) + isEmpty(CTEST_VERSION) { + message("ctest executable not found. Not running CMake unit tests") + } else { + CMAKE_VERSION = $$last(CMAKE_VERSION) + CMAKE_VERSION_MAJOR = $$section(CMAKE_VERSION, ., 0, 0) + CMAKE_VERSION_MINOR = $$section(CMAKE_VERSION, ., 1, 1) + CMAKE_VERSION_PATCH = $$section(CMAKE_VERSION, ., 2, 2) + + VERSION_OK = + greaterThan(CMAKE_VERSION_MAJOR, 2) { + VERSION_OK = 1 + } else:greaterThan(CMAKE_VERSION_MAJOR, 1):greaterThan(CMAKE_VERSION_MINOR, 8) { + VERSION_OK = 1 + } else:greaterThan(CMAKE_VERSION_MAJOR, 1):greaterThan(CMAKE_VERSION_MINOR, 7):greaterThan(CMAKE_VERSION_PATCH, 2) { + VERSION_OK = 1 + } + + isEmpty(VERSION_OK) { + message("cmake $$CMAKE_VERSION is too old for this test.") + } else { + SET = set + equals(QMAKE_DIR_SEP, "/"):SET = export + + CMAKE_BUILD_TYPE = Debug + CONFIG(release, debug|release):CMAKE_BUILD_TYPE = Release + + BUILD_DIR = $$replace($$list($$OUT_PWD/build), /, $$QMAKE_DIR_SEP) + + check.commands = \ + cd . && $$SET CMAKE_PREFIX_PATH=$$[QT_INSTALL_PREFIX] && \ + $(MKDIR) $$BUILD_DIR && cd $$BUILD_DIR && \ + cmake $$_PRO_FILE_PWD_ -DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} && \ + $(TESTRUNNER) ctest --output-on-failure + + } + } +} + +QMAKE_EXTRA_TARGETS *= check |