summaryrefslogtreecommitdiffstats
path: root/tests/auto/cmake
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2012-07-10 17:56:54 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-11 12:46:15 +0200
commit78203ccf8047151fd12a39816b2e15e210414388 (patch)
tree07609cb4048362002ece77a44a8f83274ec91609 /tests/auto/cmake
parent27cefd85f3e70b4d5e31261710e4361814c742dd (diff)
Fix unit tests when CMAKE_PREFIX_PATH env var is not set.
Tests which are expected to not build need to get a way to find the Qt 5 config packages. Because they use try_compile, there is no way to pass the contents to it. Work around that by generating a file containing the prefix which the tests will include. Change-Id: If43080c241539e4af5fe1c183e7da72066278b73 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/cmake')
-rw-r--r--tests/auto/cmake/test_add_resource_options/CMakeLists.txt6
-rw-r--r--tests/auto/cmake/test_wrap_cpp_options/CMakeLists.txt6
2 files changed, 10 insertions, 2 deletions
diff --git a/tests/auto/cmake/test_add_resource_options/CMakeLists.txt b/tests/auto/cmake/test_add_resource_options/CMakeLists.txt
index e79b954f3d..a358094546 100644
--- a/tests/auto/cmake/test_add_resource_options/CMakeLists.txt
+++ b/tests/auto/cmake/test_add_resource_options/CMakeLists.txt
@@ -3,7 +3,11 @@ cmake_minimum_required(VERSION 2.8)
project(test_add_resource_options)
-find_package(Qt5Core REQUIRED)
+if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/FindPackageHints.cmake")
+ include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHints.cmake")
+endif()
+
+find_package(Qt5Core REQUIRED HINTS ${Qt5Tests_PREFIX_PATH})
include_directories(${Qt5Core_INCLUDE_DIRS})
diff --git a/tests/auto/cmake/test_wrap_cpp_options/CMakeLists.txt b/tests/auto/cmake/test_wrap_cpp_options/CMakeLists.txt
index a7a2c0e045..0704edb58f 100644
--- a/tests/auto/cmake/test_wrap_cpp_options/CMakeLists.txt
+++ b/tests/auto/cmake/test_wrap_cpp_options/CMakeLists.txt
@@ -3,7 +3,11 @@ cmake_minimum_required(VERSION 2.8)
project(test_wrap_cpp_options)
-find_package(Qt5Core REQUIRED)
+if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/FindPackageHints.cmake")
+ include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHints.cmake")
+endif()
+
+find_package(Qt5Core REQUIRED HINTS ${Qt5Tests_PREFIX_PATH})
include_directories(${Qt5Core_INCLUDE_DIRS})