nextcloud-desktop/test/owncloud_add_test.cmake
Jocelyn Turcotte b26db062d2 Fix the UNIT_TESTING build on Windows
- Put all tests in the bin directory so that DLLs can be loaded
- Add missing exports
- Skip tests that use code depending on zlib
- The "GMT" timezone is named differently, use the int constructor instead

5 tests are still failing, it's not really worth fixing at the moment
since no developper is currently using Windows as its main platform.
2017-02-14 14:32:41 +01:00

55 lines
2.2 KiB
CMake

macro(owncloud_add_test test_class additional_cpp)
include_directories(${QT_INCLUDES}
"${PROJECT_SOURCE_DIR}/src/gui"
"${PROJECT_SOURCE_DIR}/src/libsync"
"${CMAKE_BINARY_DIR}/src/libsync"
"${CMAKE_CURRENT_BINARY_DIR}"
)
set(CMAKE_AUTOMOC TRUE)
set(OWNCLOUD_TEST_CLASS ${test_class})
string(TOLOWER "${OWNCLOUD_TEST_CLASS}" OWNCLOUD_TEST_CLASS_LOWERCASE)
add_executable(${OWNCLOUD_TEST_CLASS}Test test${OWNCLOUD_TEST_CLASS_LOWERCASE}.cpp ${additional_cpp})
qt5_use_modules(${OWNCLOUD_TEST_CLASS}Test Test Sql Xml Network)
set_target_properties(${OWNCLOUD_TEST_CLASS}Test PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY})
target_link_libraries(${OWNCLOUD_TEST_CLASS}Test
updater
${APPLICATION_EXECUTABLE}sync
${QT_QTTEST_LIBRARY}
${QT_QTCORE_LIBRARY}
)
add_definitions(-DOWNCLOUD_TEST)
add_definitions(-DOWNCLOUD_BIN_PATH=${CMAKE_BINARY_DIR}/bin)
add_test(NAME ${OWNCLOUD_TEST_CLASS}Test COMMAND ${OWNCLOUD_TEST_CLASS}Test)
endmacro()
macro(owncloud_add_benchmark test_class additional_cpp)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${QT_INCLUDES}
"${PROJECT_SOURCE_DIR}/src/gui"
"${PROJECT_SOURCE_DIR}/src/libsync"
"${CMAKE_BINARY_DIR}/src/libsync"
"${CMAKE_CURRENT_BINARY_DIR}"
)
set(CMAKE_AUTOMOC TRUE)
set(OWNCLOUD_TEST_CLASS ${test_class})
string(TOLOWER "${OWNCLOUD_TEST_CLASS}" OWNCLOUD_TEST_CLASS_LOWERCASE)
add_executable(${OWNCLOUD_TEST_CLASS}Bench benchmarks/bench${OWNCLOUD_TEST_CLASS_LOWERCASE}.cpp ${additional_cpp})
qt5_use_modules(${OWNCLOUD_TEST_CLASS}Bench Test Sql Xml Network)
set_target_properties(${OWNCLOUD_TEST_CLASS}Bench PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY})
target_link_libraries(${OWNCLOUD_TEST_CLASS}Bench
updater
${APPLICATION_EXECUTABLE}sync
${QT_QTTEST_LIBRARY}
${QT_QTCORE_LIBRARY}
)
add_definitions(-DOWNCLOUD_TEST)
add_definitions(-DOWNCLOUD_BIN_PATH=${CMAKE_BINARY_DIR}/bin)
endmacro()