Reorganise the test CMakeLists.txt file.

Add a CMake macro for easily adding new tests.
This commit is contained in:
Matt Williams
2010-02-26 15:13:10 +00:00
parent 3422503eeb
commit 6a828ec244

View File

@ -1,3 +1,15 @@
# Creates a test from the inputs
#
# Also sets LATEST_TEST to point to the output executable of the test for easy
# ADD_TEST()ing
MACRO(CREATE_TEST headerfile sourcefile executablename)
QT4_WRAP_CPP(test_moc_SRCS ${headerfile})
ADD_EXECUTABLE(${executablename} ${sourcefile} ${test_moc_SRCS})
TARGET_LINK_LIBRARIES(${executablename} PolyVoxCore PolyVoxUtil ${QT_LIBRARIES})
SET(LATEST_TEST ${EXECUTABLE_OUTPUT_PATH}/${executablename})
ENDMACRO(CREATE_TEST)
# Find the QTestLib stuff
FIND_PACKAGE(Qt4) FIND_PACKAGE(Qt4)
SET(QT_USE_QTTEST TRUE) SET(QT_USE_QTTEST TRUE)
SET(QT_DONT_USE_QTGUI TRUE) SET(QT_DONT_USE_QTGUI TRUE)
@ -5,18 +17,12 @@ INCLUDE(${QT_USE_FILE})
INCLUDE_DIRECTORIES(${PolyVox_SOURCE_DIR}/PolyVoxCore/include ${CMAKE_CURRENT_BINARY_DIR}) INCLUDE_DIRECTORIES(${PolyVox_SOURCE_DIR}/PolyVoxCore/include ${CMAKE_CURRENT_BINARY_DIR})
# Volume test executable
SET(volume_SRCS testvolume.cpp) # Volume tests
SET(volume_HDRS testvolume.h) CREATE_TEST(testvolume.h testvolume.cpp testvolume)
QT4_WRAP_CPP(volume_moc_SRCS ${volume_HDRS}) ADD_TEST(VolumeSizeTest ${LATEST_TEST} testSize)
ADD_EXECUTABLE(testvolume ${volume_SRCS} ${volume_moc_SRCS})
TARGET_LINK_LIBRARIES(testvolume PolyVoxCore ${QT_LIBRARIES})
# Set up volume tests #Vector tests
#CREATE_TEST(testvector.h testvector.cpp testvector)
ADD_TEST(VolumeSizeTest ${EXECUTABLE_OUTPUT_PATH}/testvolume testSize) #ADD_TEST(VectorLengthTest ${LATEST_TEST} testLength)
#ADD_TEST(VectorDotProductTest ${LATEST_TEST} testDotProduct)
SET(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE)