Prechádzať zdrojové kódy

BUG: Test ctkDICOMApplicationTest is now added properly

The test was linking against ctkDICOMWidgets whereas it's depend only
on ctkDICOMCore.

Also make sure test sources are added only when the underlying dependencies
are satisfied.
Jean-Christophe Fillion-Robin 14 rokov pred
rodič
commit
2d921e96c5

+ 17 - 2
Applications/Testing/Cpp/CMakeLists.txt

@@ -1,7 +1,22 @@
-SET(KIT ${PROJECT_NAME})
+SET(KIT CTKApplication)
+
+SET(KIT_TEST_SRCS)
+
+## Query / Retrieve Testing
+if(CTK_APP_ctkDICOMQuery AND CTK_APP_ctkDICOMRetrieve)
+  LIST(APPEND KIT_TEST_SRCS
+    ctkDICOMApplicationTest1.cpp
+    )
+endif()
+
+# If there is no tests, exit
+LIST(LENGTH KIT_TEST_SRCS KIT_TEST_SRCS_LENGTH)
+if(${KIT_TEST_SRCS_LENGTH} EQUAL 0)
+  RETURN()
+endif()
 
 
 CREATE_TEST_SOURCELIST(Tests ${KIT}CppTests.cpp
 CREATE_TEST_SOURCELIST(Tests ${KIT}CppTests.cpp
-  ctkDICOMApplicationTest1.cpp
+  ${KIT_TEST_SRCS}
   )
   )
 
 
 SET (TestsToRun ${Tests})
 SET (TestsToRun ${Tests})

+ 2 - 2
Applications/Testing/Cpp/ctkDICOMApplicationTest1.cpp

@@ -1,7 +1,7 @@
 
 
 // Qt includes
 // Qt includes
 #include <QTextStream>
 #include <QTextStream>
-#include <QApplication>
+#include <QCoreApplication>
 #include <QProcess>
 #include <QProcess>
 
 
 // STD includes
 // STD includes
@@ -23,7 +23,7 @@ findscu -aet CTK_AE -aec COMMONTK -P -k 0010,0010=\* localhost 11112 patqry.dcm
 
 
 int ctkDICOMApplicationTest1(int argc, char * argv []) {
 int ctkDICOMApplicationTest1(int argc, char * argv []) {
   
   
-  QApplication app(argc, argv);
+  QCoreApplication app(argc, argv);
   QTextStream out(stdout);
   QTextStream out(stdout);
 
 
   if ( argc < 10 )
   if ( argc < 10 )

+ 7 - 1
Applications/Testing/Cpp/target_libraries.cmake

@@ -5,5 +5,11 @@
 # 
 # 
 
 
 SET(target_libraries
 SET(target_libraries
-  CTKDICOMWidgets
   )
   )
+
+## Query / Retrieve Testing
+if(CTK_APP_ctkDICOMQuery AND CTK_APP_ctkDICOMRetrieve)
+  LIST(APPEND target_libraries 
+    CTKDICOMCore
+    )
+endif()