Ensured that unit tests run in the directory containing the QHttpEngine library.

This commit is contained in:
Nathan Osman
2015-07-18 17:14:22 -07:00
parent 5eb09aa180
commit 3f51d915ad
4 changed files with 18 additions and 31 deletions

View File

@@ -1,30 +1,25 @@
find_package(Qt5Test REQUIRED)
find_package(Qt5Test 5.1 REQUIRED)
add_subdirectory(common)
set(TESTS
TestQFilesystemHandler.cpp
TestQHttpHandler.cpp
TestQHttpParser.cpp
TestQHttpServer.cpp
TestQHttpSocket.cpp
TestQIByteArray.cpp
TestQIODeviceCopier.cpp
TestQLocalFile.cpp
TestQObjectHandler.cpp
TestQFilesystemHandler
TestQHttpHandler
TestQHttpParser
TestQHttpServer
TestQHttpSocket
TestQIByteArray
TestQIODeviceCopier
TestQLocalFile
TestQObjectHandler
)
foreach(TEST ${TESTS})
get_filename_component(NAME "${TEST}" NAME_WE)
add_executable(${NAME} "${TEST}")
qt5_use_modules(${NAME} Test)
target_link_libraries(${NAME} QHttpEngine common)
set_target_properties(${NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}"
)
add_test(NAME ${NAME}
COMMAND ${NAME}
add_executable(${TEST} ${TEST}.cpp)
qt5_use_modules(${TEST} Test)
target_link_libraries(${TEST} QHttpEngine common)
add_test(NAME ${TEST}
COMMAND ${TEST}
WORKING_DIRECTORY "$<TARGET_FILE_DIR:QHttpEngine>"
)
endforeach()