##// END OF EJS Templates
Give executable name to parent to be able to find in in the package cmake file
perrinel -
r49:d3f4b1e4846d
parent child
Show More
@@ -1,148 +1,149
1 1
2 2 ## sciqlop - CMakeLists.txt
3 3 SET(EXECUTABLE_NAME "sciqlop")
4 SCIQLOP_SET_TO_PARENT_SCOPE(EXECUTABLE_NAME)
4 5 SET(SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/)
5 6 SET(INCLUDE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/include)
6 7 SET(UI_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/src)
7 8 SET(RES_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/resources)
8 9
9 10 #
10 11 # Find Qt modules
11 12 #
12 13 SCIQLOP_FIND_QT(Core Widgets)
13 14
14 15 #
15 16 # Find dependent libraries
16 17 # ========================
17 18 find_package(sciqlop-gui)
18 19
19 20 SET(LIBRARIES ${SCIQLOP-GUI_LIBRARIES})
20 21 SET(EXTERN_SHARED_LIBRARIES)
21 22
22 23 INCLUDE_DIRECTORIES(${SCIQLOP-GUI_INCLUDE_DIR})
23 24
24 25 # Add sqpcore to the list of libraries to use
25 26 list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME})
26 27
27 28 # Include core directory
28 29 include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../core/include")
29 30
30 31 # Add dependent shared libraries
31 32 list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES})
32 33
33 34 # Retrieve the location of the dynamic library to copy it to the output path
34 35 #get_property(sqpcoreLocation TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY LOCATION)
35 36 list(APPEND SHARED_LIBRARIES_FROM_TARGETS ${sqpcoreLocation})
36 37
37 38 #
38 39 # Compile the application
39 40 #
40 41 FILE (GLOB_RECURSE APPLICATION_SOURCES
41 42 ${SOURCES_DIR}/*.c
42 43 ${SOURCES_DIR}/*.cpp
43 44 ${SOURCES_DIR}/*.h)
44 45
45 46 # Headers files (.h)
46 47 FILE (GLOB_RECURSE PROJECT_HEADERS ${INCLUDE_FOLDER}/*.h)
47 48
48 49 # Ui files
49 50 FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui)
50 51
51 52 # Resources files
52 53 FILE (GLOB_RECURSE PROJECT_RESOURCES ${RES_FOLDER}/*.qrc)
53 54
54 55 # Retrieve resources files
55 56 FILE (GLOB_RECURSE APPLICATION_RESOURCES ${RES_FOLDER}/*.qrc)
56 57
57 58 QT5_ADD_RESOURCES(RCC_HDRS ${APPLICATION_RESOURCES} )
58 59
59 60 QT5_WRAP_UI(UIS_HDRS
60 61 ${PROJECT_FORMS}
61 62 )
62 63
63 64
64 65 ADD_EXECUTABLE(${EXECUTABLE_NAME} ${APPLICATION_SOURCES} ${RCC_HDRS} ${UIS_HDRS})
65 66 set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 14)
66 67 set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
67 68 target_link_libraries(${EXECUTABLE_NAME}
68 69 ${LIBRARIES})
69 70
70 71 # Link with Qt5 modules
71 72 qt5_use_modules(${EXECUTABLE_NAME} Core Widgets)
72 73
73 74
74 75 # Add the files to the list of files to be analyzed
75 76 LIST(APPEND CHECKSTYLE_INPUT_FILES ${APPLICATION_SOURCES})
76 77 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
77 78 # Vera++ exclusion files
78 79 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
79 80 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
80 81
81 82 #
82 83 # Compile the tests
83 84 #
84 85 IF(BUILD_TESTS)
85 86
86 87 INCLUDE_DIRECTORIES(${SOURCES_DIR})
87 88 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
88 89 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
89 90 SET( TEST_LIBRARIES ${LIBRARIES})
90 91
91 92 FOREACH( testFile ${TESTS_SOURCES} )
92 93 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
93 94 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
94 95
95 96 # Add to the list of sources files all the sources in the same
96 97 # directory that aren't another test
97 98 FILE (GLOB currentTestSources
98 99 ${testDirectory}/*.c
99 100 ${testDirectory}/*.cpp
100 101 ${testDirectory}/*.h)
101 102 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
102 103 LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
103 104
104 105 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
105 106 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES})
106 107 qt5_use_modules(${testName} Test)
107 108
108 109 ADD_TEST( NAME ${testName} COMMAND ${testName} )
109 110
110 111 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName})
111 112 ENDFOREACH( testFile )
112 113
113 114 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
114 115 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
115 116 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
116 117
117 118 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
118 119 ENDIF(BUILD_TESTS)
119 120
120 121 #
121 122 # Set the files that must be formatted by clang-format.
122 123 #
123 124 LIST (APPEND FORMATTING_INPUT_FILES ${APPLICATION_SOURCES})
124 125 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
125 126
126 127 #
127 128 # Set the directories that doxygen must browse to generate the
128 129 # documentation.
129 130 #
130 131 # Source directories:
131 132 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
132 133 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
133 134 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
134 135 # Source directories to exclude from the documentation generation
135 136 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
136 137 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
137 138
138 139 #
139 140 # Set the directories with the sources to analyze and propagate the
140 141 # modification to the parent scope
141 142 #
142 143 # Source directories to analyze:
143 144 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
144 145 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
145 146 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
146 147 # Source directories to exclude from the analysis
147 148 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
148 149 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
General Comments 0
You need to be logged in to leave comments. Login now