##// END OF EJS Templates
Add the coverage target whith the test. make coverage will call the code...
perrinel -
r44:31b8fb9583a3
parent child
Show More
@@ -1,132 +1,141
1 1
2 2 ## core - CMakeLists.txt
3 3 STRING(TOLOWER ${CMAKE_PROJECT_NAME} LIBRARY_PREFFIX)
4 4 SET(SQPCORE_LIBRARY_NAME "${LIBRARY_PREFFIX}_core${DEBUG_SUFFIX}")
5 5 SET(SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/")
6 6 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/")
7 7
8 8 # Include core directory
9 9 include_directories("${INCLUDES_DIR}")
10 10
11 11 # Set a variable to display a warning in the version files.
12 12 SET(SCIQLOP_CMAKE_GENERATION_WARNING "DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE.")
13 13 # Generate the version file from the cmake version variables. The version
14 14 # variables are defined in the cmake/sciqlop_version.cmake file.
15 15 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.h.in"
16 16 "${INCLUDES_DIR}/Version.h")
17 17 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/resources/Version.cpp.in"
18 18 "${SOURCES_DIR}/Version.cpp")
19 19
20 20 #
21 21 # Find Qt modules
22 22 #
23 23 SCIQLOP_FIND_QT(Core)
24 24
25 25 #
26 26 # Compile the library library
27 27 #
28 28 FILE (GLOB_RECURSE MODULE_SOURCES
29 29 ${INCLUDES_DIR}/*.h
30 30 ${SOURCES_DIR}/*.c
31 31 ${SOURCES_DIR}/*.cpp
32 32 ${SOURCES_DIR}/*.h)
33 33
34 34 ADD_LIBRARY(${SQPCORE_LIBRARY_NAME} ${MODULE_SOURCES})
35 35 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD 14)
36 36 set_property(TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
37 37 TARGET_LINK_LIBRARIES(${SQPCORE_LIBRARY_NAME})
38 38 qt5_use_modules(${SQPCORE_LIBRARY_NAME} Core)
39 39
40 40 # From cmake documentation: http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html
41 41 # Entries in the COMPILE_DEFINITIONS are prefixed with -D or /D and added to the compile line in an unspecified order.
42 42 # The DEFINE_SYMBOL target property is also added as a compile definition as a special convenience case for SHARED and MODULE library targets
43 43 IF(BUILD_SHARED_LIBS)
44 44 SET_TARGET_PROPERTIES(${SQPCORE_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS "SCIQLOP_EXPORT")
45 45 ELSE()
46 46 TARGET_COMPILE_DEFINITIONS(${SQPCORE_LIBRARY_NAME} PUBLIC "SCIQLOP_STATIC_LIBRARIES")
47 47 ENDIF()
48 48
49 49 # Set the variable to parent scope so that the other projects can copy the
50 50 # dependent shared libraries
51 51 SCIQLOP_SET_TO_PARENT_SCOPE(SQPCORE_LIBRARY_NAME)
52 52
53 53 # Copy extern shared libraries to the lib folder
54 54 SCIQLOP_COPY_TO_TARGET(LIBRARY ${SQPCORE_LIBRARY_NAME} ${EXTERN_SHARED_LIBRARIES})
55 55
56 56 # Add the files to the list of files to be analyzed
57 57 LIST(APPEND CHECKSTYLE_INPUT_FILES ${MODULE_SOURCES})
58 58 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
59 59 # Vera++ exclusion files
60 60 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
61 61 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
62 62
63 63 #
64 64 # Compile the tests
65 65 #
66 66 IF(BUILD_TESTS)
67 67 INCLUDE_DIRECTORIES(${SOURCES_DIR})
68 68 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
69 69 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
70 70 SET( TEST_LIBRARIES ${SQPCORE_LIBRARY_NAME})
71 71
72 SET(TARGETS_COV)
72 73 FOREACH( testFile ${TESTS_SOURCES} )
73 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
74 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
74 75 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
75 76
76 77 # Add to the list of sources files all the sources in the same
77 78 # directory that aren't another test
78 79 FILE (GLOB currentTestSources
79 80 ${testDirectory}/*.c
80 81 ${testDirectory}/*.cpp
81 82 ${testDirectory}/*.h)
82 83 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
83 84 # LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
84 85
85 86 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
86 87 set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
87 88 set_property(TARGET ${testName} PROPERTY CXX_STANDARD_REQUIRED ON)
88 89 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES} )
89 90 qt5_use_modules(${testName} Test)
90 91
91 ADD_TEST( NAME ${testName} COMMAND ${testDirectory} )
92 ADD_TEST( NAME ${testName} COMMAND ${testName} )
92 93
93 94 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName} ${EXTERN_SHARED_LIBRARIES})
94 95 set(Coverage_NAME ${testName})
95 96 SETUP_TARGET_FOR_COVERAGE(TARGET ${testName}_coverage OUTPUT ${testFile}-path NAME ${testFile} EXECUTABLE ${testName})
96 ENDFOREACH( testFile )
97 LIST( APPEND TARGETS_COV ${testName}_coverage)
98
99 ENDFOREACH( testFile )
100
101 add_custom_target(coverage)
102
103 FOREACH( target_cov ${TARGETS_COV} )
104 add_custom_command(TARGET coverage PRE_BUILD COMMAND make ${target_cov})
105 ENDFOREACH( target_cov )
97 106
98 107 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
99 108 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
100 109 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
101 110 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
102 111 ENDIF(BUILD_TESTS)
103 112
104 113 #
105 114 # Set the files that must be formatted by clang-format.
106 115 #
107 116 LIST (APPEND FORMATTING_INPUT_FILES ${MODULE_SOURCES})
108 117 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
109 118
110 119 #
111 120 # Set the directories that doxygen must browse to generate the
112 121 # documentation.
113 122 #
114 123 # Source directories:
115 124 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
116 125 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
117 126 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
118 127 # Source directories to exclude from the documentation generation
119 128 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
120 129 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
121 130
122 131 #
123 132 # Set the directories with the sources to analyze and propagate the
124 133 # modification to the parent scope
125 134 #
126 135 # Source directories to analyze:
127 136 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
128 137 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
129 138 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
130 139 # Source directories to exclude from the analysis
131 140 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
132 141 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
General Comments 5
Under Review
author

Auto status change to "Under Review"

Rejected
author

Closing with Status change > Rejected

Under Review
author

Auto status change to "Under Review"

Approved
author

Status change > Approved

You need to be logged in to leave comments. Login now