Move FindQt5Test logic inside tests directory

This commit is contained in:
Matt Williams 2015-02-28 10:40:05 +00:00
parent d9dae773dc
commit 41d5ea6178
2 changed files with 48 additions and 43 deletions

View File

@ -33,11 +33,6 @@ MARK_AS_ADVANCED(FORCE POLYVOX_VERSION)
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
include(FeatureSummary)
find_package(Qt5Test 5.2)
set_package_properties(Qt5Test PROPERTIES DESCRIPTION "C++ framework" URL http://qt-project.org)
set_package_properties(Qt5Test PROPERTIES TYPE OPTIONAL PURPOSE "Building the tests")
IF(CMAKE_COMPILER_IS_GNUCXX) #Maybe "OR MINGW"
ADD_DEFINITIONS(-std=c++0x) #Enable C++0x mode
ENDIF()
@ -57,11 +52,10 @@ ENDIF()
INCLUDE(Packaging.cmake)
OPTION(ENABLE_TESTS "Should the tests be built" ON)
IF(ENABLE_TESTS AND Qt5Test_FOUND)
IF(ENABLE_TESTS)
INCLUDE(CTest)
MARK_AS_ADVANCED(FORCE BUILD_TESTING)
ADD_SUBDIRECTORY(tests)
SET(BUILD_TESTS ON)
ELSE()
SET(BUILD_TESTS OFF)
ENDIF()

View File

@ -20,6 +20,11 @@
# 3. This notice may not be removed or altered from any source
# distribution.
find_package(Qt5Test 5.2)
set_package_properties(Qt5Test PROPERTIES DESCRIPTION "C++ framework" URL http://qt-project.org)
set_package_properties(Qt5Test PROPERTIES TYPE OPTIONAL PURPOSE "Building the tests")
# Creates a test from the inputs
#
# Also sets LATEST_TEST to point to the output executable of the test for easy
@ -66,6 +71,9 @@ IF(BUILD_BINDINGS)
ENDIF()
ENDIF()
if(Qt5Test_FOUND)
SET(BUILD_TESTS ON PARENT_SCOPE)
# AmbientOcclusionGenerator tests
CREATE_TEST(TestAmbientOcclusionGenerator.cpp TestAmbientOcclusionGenerator)
@ -102,3 +110,6 @@ CREATE_TEST(testvolume.cpp testvolume)
# Volume subclass tests
CREATE_TEST(TestVolumeSubclass.cpp TestVolumeSubclass)
else()
SET(BUILD_TESTS OFF PARENT_SCOPE)
endif()