Просмотр исходного кода

ENH: BuildSystem - Enforce the fact that each application should have a <APP_NAME>Main.cpp file

A fatal error will be displayed to the developer if there is no such file.

Note that the file could either located in the corresponding
 source or binary directory.

The system also accept <APP_NAME>Main.cpp.in
Jean-Christophe Fillion-Robin лет назад: 15
Родитель
Сommit
9162088e41

+ 1 - 1
Applications/ctkCLIPluginExplorer/CMakeLists.txt

@@ -5,7 +5,7 @@ PROJECT(ctkCLIPluginExplorer)
 #
 
 SET(KIT_SRCS
-  ctkCLIPluginExplorer.cxx
+  ctkCLIPluginExplorerMain.cxx
 )
 
 # Headers that should run through moc

Applications/ctkCLIPluginExplorer/ctkCLIPluginExplorer.cpp → Applications/ctkCLIPluginExplorer/ctkCLIPluginExplorerMain.cpp


+ 1 - 1
Applications/ctkDICOM/CMakeLists.txt

@@ -6,7 +6,7 @@ PROJECT(ctkDICOM)
   
 # Source files
 SET(KIT_SRCS
-  ctkDICOM.cpp
+  ctkDICOMMain.cpp
   )
 
 # Headers that should run through moc

Applications/ctkDICOM/ctkDICOM.cpp → Applications/ctkDICOM/ctkDICOMMain.cpp


+ 1 - 1
Applications/ctkDICOMDemoSCU/CMakeLists.txt

@@ -20,7 +20,7 @@ SET(KIT_include_directories
   
 # Source files
 SET(KIT_SRCS
-  ctkDICOMDemoSCU.cpp
+  ctkDICOMDemoSCUMain.cpp
   )
 
 # Headers that should run through moc

Applications/ctkDICOMDemoSCU/ctkDICOMDemoSCU.cpp → Applications/ctkDICOMDemoSCU/ctkDICOMDemoSCUMain.cpp


+ 1 - 1
Applications/ctkDICOMIndexer/CMakeLists.txt

@@ -6,7 +6,7 @@ PROJECT(ctkDICOMIndexer)
   
 # Source files
 SET(KIT_SRCS
-  ctkDICOMIndexer.cpp
+  ctkDICOMIndexerMain.cpp
   )
 
 # Headers that should run through moc

Applications/ctkDICOMIndexer/ctkDICOMIndexer.cpp → Applications/ctkDICOMIndexer/ctkDICOMIndexerMain.cpp


+ 1 - 1
Applications/ctkDICOMQuery/CMakeLists.txt

@@ -6,7 +6,7 @@ PROJECT(ctkDICOMQuery)
   
 # Source files
 SET(KIT_SRCS
-  ctkDICOMQuery.cpp
+  ctkDICOMQueryMain.cpp
   )
 
 # Headers that should run through moc

Applications/ctkDICOMQuery/ctkDICOMQuery.cpp → Applications/ctkDICOMQuery/ctkDICOMQueryMain.cpp


+ 10 - 0
CMake/ctkMacroBuildApp.cmake

@@ -41,6 +41,16 @@ MACRO(ctkMacroBuildApp)
 #     SET(MY_LIBRARY_TYPE "SHARED")
 #   ENDIF()
 
+  # Make sure either the source or the binary directory associated with the application
+  # contains a file named ${MY_NAME}Main.cpp
+  set(expected_mainfile ${MY_NAME}Main.cpp)
+  if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${expected_mainfile} AND
+      NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${expected_mainfile}.in AND
+      NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${expected_mainfile})
+    MESSAGE(FATAL_ERROR "Application directory: ${MY_NAME} should contains"
+                        " a file named ${expected_mainfile} or ${expected_mainfile}.in")
+  endif()
+
   # Define library name
   SET(proj_name ${MY_NAME})
 

+ 1 - 1
CMakeLists.txt

@@ -280,11 +280,11 @@ SET(CTK_PLUGINS
 #
 SET(CTK_APPLICATIONS
   ctkCLIPluginExplorer:OFF
-  ctkPluginBrowser:OFF
   ctkDICOM:OFF
   ctkDICOMIndexer:OFF
   ctkDICOMDemoSCU:OFF
   ctkDICOMQuery:OFF
+  ctkPluginBrowser:OFF
   )
   
 #-----------------------------------------------------------------------------