Mercurial > trustbridge
changeset 496:fa3a7ebf0049
Move some common UI code into a library to avoid recompiling for each test
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 25 Apr 2014 10:15:39 +0000 |
parents | 7a8f5b85fd9a |
children | 5e77d1c4826c |
files | ui/CMakeLists.txt ui/tests/CMakeLists.txt |
diffstat | 2 files changed, 16 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/ui/CMakeLists.txt Fri Apr 25 10:14:33 2014 +0000 +++ b/ui/CMakeLists.txt Fri Apr 25 10:15:39 2014 +0000 @@ -12,22 +12,22 @@ find_package(Qt5LinguistTools) -set(CERTIFICATELIST_SOURCES +# Common code is used in either the client or the administrat +# application or in unit tests. +set(UICOMMON_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/certificatelist.cpp ${CMAKE_CURRENT_SOURCE_DIR}/certificate.cpp -) - -set(DOWNLOADER_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/downloader.cpp ${CMAKE_CURRENT_SOURCE_DIR}/sslconnection.cpp ${CMAKE_CURRENT_SOURCE_DIR}/sslhelp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/aboutdialog.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/createcertlistdialog.cpp ) set(TRUSTBRIDGE_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.cpp ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.cpp ${CMAKE_CURRENT_SOURCE_DIR}/helpdialog.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/aboutdialog.cpp ${CMAKE_CURRENT_SOURCE_DIR}/statusdialog.cpp ${CMAKE_CURRENT_SOURCE_DIR}/certificateitemdelegate.cpp ${CMAKE_CURRENT_SOURCE_DIR}/separatoritemdelegate.cpp @@ -42,9 +42,6 @@ ${CMAKE_CURRENT_SOURCE_DIR}/certificatetablemodel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/certificatetabledelegate.cpp ${CMAKE_CURRENT_SOURCE_DIR}/createinstallerdialog.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/createcertlistdialog.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/aboutdialog.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/sslhelp.cpp ${CERTIFICATELIST_SOURCES} ) @@ -136,13 +133,17 @@ add_executable(trustbridge ${TRUSTBRIDGE_SOURCES_WITH_RESOURCES}) endif() +add_library(ui_common STATIC ${UICOMMON_SOURCES}) + target_link_libraries(administrator Qt5::Widgets + ui_common trustbridge_common ${POLARSSL_LIBRARIES} ${EXTRA_STATIC_LIBS} ${PROFILING_LIBS}) target_link_libraries(trustbridge Qt5::Widgets + ui_common trustbridge_common ${POLARSSL_LIBRARIES} ${EXTRA_STATIC_LIBS}
--- a/ui/tests/CMakeLists.txt Fri Apr 25 10:14:33 2014 +0000 +++ b/ui/tests/CMakeLists.txt Fri Apr 25 10:15:39 2014 +0000 @@ -31,7 +31,9 @@ ${CMAKE_CURRENT_SOURCE_DIR}/data/testdata.qrc) add_executable(${_name} ${_test_sources_with_resources}) add_test(tb-${_name} ${_name}) - target_link_libraries(${_name} Qt5::Test Qt5::Widgets + target_link_libraries(${_name} + ui_common + Qt5::Test Qt5::Widgets trustbridge_common ${POLARSSL_LIBRARIES} ${EXTRA_STATIC_LIBS}) @@ -44,26 +46,24 @@ # Downloader if (HIAWATHA_EXECUTABLE) - set(DOWNLOADER_SOURCES_WITH_RESOURCES ${DOWNLOADER_SOURCES}) qt5_add_resources(DOWNLOADER_SOURCES_WITH_RESOURCES ${TRUSTBRIDGE_RESOURCES}) add_custom_test(downloadertest.cpp "${DOWNLOADER_SOURCES_WITH_RESOURCES}") endif() # Cinstprocess -add_custom_test(cinstprocesstest.cpp "${CERTIFICATELIST_SOURCES}") +add_custom_test(cinstprocesstest.cpp "") add_dependencies(cinstprocesstest cinst) add_custom_test(commontest.cpp "") -add_custom_test(createcertlisttest.cpp "${CERTIFICATELIST_SOURCES};${CMAKE_SOURCE_DIR}/ui/sslhelp.cpp;${CMAKE_SOURCE_DIR}/ui/createcertlistdialog.cpp") +add_custom_test(createcertlisttest.cpp "") if (WIN32) - add_custom_test(windowsstoretest.cpp "${CERTIFICATELIST_SOURCES};${CMAKE_SOURCE_DIR}/cinst/windowsstore.c") + add_custom_test(windowsstoretest.cpp "${CMAKE_SOURCE_DIR}/cinst/windowsstore.c") endif (WIN32) if (NSS_FOUND) include_directories(${NSS_INCLUDE_DIRS}) set(NSSTEST_SOURCES - ${CERTIFICATELIST_SOURCES} ${CMAKE_SOURCE_DIR}/cinst/nssstore_linux.c ${CMAKE_SOURCE_DIR}/cinst/nssstore_win.c) add_custom_test(nsstest.cpp "${NSSTEST_SOURCES}")