[PATCH 3 of 6] Move some common UI code into a library to avoid recompiling for each test

Wald Commits scm-commit at wald.intevation.org
Fri Apr 25 12:16:56 CEST 2014


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1398420939 0
# Node ID fa3a7ebf004990017aede28ad5c38daf6142194d
# Parent  7a8f5b85fd9a8c1f75c4ef14f7d0013a487c84c1
Move some common UI code into a library to avoid recompiling for each test

diff -r 7a8f5b85fd9a -r fa3a7ebf0049 ui/CMakeLists.txt
--- 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}/main.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/main.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}
diff -r 7a8f5b85fd9a -r fa3a7ebf0049 ui/tests/CMakeLists.txt
--- 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}")


More information about the Trustbridge-commits mailing list