mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
f427955512
Remove all configure_files: - Move all tests to cpp files - Use the QTEST_MAIN macro instead of a generated main.cpp - Include test*.moc in the cpp to let CMAKE_AUTOMOC call moc - Pass info through add_definitions instead of generating oc_bin.h with them This makes sure that build errors points to the original test source file instead of the generated one in the build directory to be able to jump and fix errors directly from the IDE's error pane.
26 lines
1 KiB
CMake
26 lines
1 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 Gui Widgets)
|
|
|
|
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()
|