Computer Assisted Medical Intervention Tool Kit  version 5.1
 
Loading...
Searching...
No Matches
GatherHeadersAndSources.h
Go to the documentation of this file.
1
16 # gather all possible C++ and Qt sources
17 if (${ARGC} EQUAL 1)
18 file(GLOB_RECURSE HEADERS *.h)
19 file(GLOB_RECURSE SRCS *.cpp *.c)
20 file(GLOB_RECURSE File_UI *.ui)
21 file(GLOB_RECURSE File_QRC *.qrc)
22 else()
23 # if an optional parameter is used, gather everything from BaseDirectory
24 file(GLOB_RECURSE HEADERS ${ARGV1}/*.h )
25 file(GLOB_RECURSE SRCS ${ARGV1}/*.cpp *.c)
26 file(GLOB_RECURSE File_UI ${ARGV1}/*.ui )
27 file(GLOB_RECURSE File_QRC ${ARGV1}/*.qrc )
28 endif()
29
30 # manage Qt ui
31 qt5_wrap_ui (UI ${File_UI})
32
33 # manage Qt resources
34 qt5_add_resources(QRC ${File_QRC})
35
36 # find Q_OBJECT derived class
37 foreach(HEADER ${HEADERS})
38 file(READ ${HEADER} stream)
39 if(stream MATCHES "Q_OBJECT")
40 set(MOC_SOURCES ${MOC_SOURCES} ${HEADER})
41 endif(stream MATCHES "Q_OBJECT")
42 endforeach(HEADER)
43
44 # On Windows, Visual Studio, organize files in subdirectories
45 if(MSVC)
46 source_group("Header Files\\UI Files" FILES ${UI})
47 source_group("Source Files\\Moc Files" "moc_*")
48 source_group("Source Files\\CLI Files" "CommandLineOptions.*")
49 source_group("Source Files\\Resources Files" "qrc_*")
50 source_group("Source Files\\Resources Files" "*.qrc")
51 source_group("UI Files" FILES ${File_UI})
52 endif()
53
54 # name all headers
55 set (${Name}_HEADERS
56 ${HEADERS}
57 ${UI}
58 ${QRC}
59 )
60
61 # name all sources
62 set (${Name}_SOURCES
63 ${HEADERS}
64 ${UI}
65 ${QRC}
66 ${SRCS}
67 ${QT_SRCS}
68 )
69end(){)
gather_headers_and_sources()
macro gather_headers_and_sources find all headers, sources, including the qt ui, moc and resources an...
Definition GatherHeadersAndSources.h:15