Merge lp:~chris.gagnon/cmake-extras/lowercase-lcov-cleanup-whitespace into lp:cmake-extras

Proposed by Chris Gagnon on 2014-05-28
Status: Needs review
Proposed branch: lp:~chris.gagnon/cmake-extras/lowercase-lcov-cleanup-whitespace
Merge into: lp:cmake-extras
Diff against target: 228 lines (+67/-67)
3 files modified
EnableCoverageReport.cmake (+24/-24)
FindGcovr.cmake (+43/-0)
Findgcovr.cmake (+0/-43)
To merge this branch: bzr merge lp:~chris.gagnon/cmake-extras/lowercase-lcov-cleanup-whitespace
Reviewer Review Type Date Requested Status
Michi Henning (community) Approve on 2015-05-29
Allan LeSage Needs Fixing on 2014-05-28
Jussi Pakkanen (community) 2014-05-28 Approve on 2014-05-28
Review via email: mp+221196@code.launchpad.net
To post a comment you must log in.
Jussi Pakkanen (jpakkane) wrote :

LGTM

review: Approve
Allan LeSage (allanlesage) wrote :

The casing matches not the binary but the supporting cmake file, in this case 'FindLcov.cmake', so this breaks. Surveying the output of 'ls /usr/share/cmake-2.8/Modules/' there doesn't appear to be a standard for casing, although camel-case appears more common. What should we do?

review: Needs Fixing
7. By Chris Gagnon on 2014-05-28

make gcover follow cmake standard, revert lowercase lcov

Michi Henning (michihenning) wrote :

Seeing that Findgcovr will rarely be called directly and normally be dragged in as part of EnableCoverageReport, I think it makes sense to change this.

review: Approve

Unmerged revisions

7. By Chris Gagnon on 2014-05-28

make gcover follow cmake standard, revert lowercase lcov

6. By Chris Gagnon on 2014-05-28

lowercase Lcov, clean up whitespace

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'EnableCoverageReport.cmake'
2--- EnableCoverageReport.cmake 2014-05-27 12:26:14 +0000
3+++ EnableCoverageReport.cmake 2014-05-28 15:24:32 +0000
4@@ -37,10 +37,10 @@
5 # Bielefeld University
6
7 FIND_PACKAGE(Lcov)
8-FIND_PACKAGE(gcovr)
9+FIND_PACKAGE(Gcovr)
10
11 FUNCTION(ENABLE_COVERAGE_REPORT)
12-
13+
14 # argument parsing
15 SET(MULTI_VALUE_ARGS FILTER TARGETS TESTS)
16 CMAKE_PARSE_ARGUMENTS(ENABLE_COVERAGE_REPORT "" "" "${MULTI_VALUE_ARGS}" ${ARGN})
17@@ -50,7 +50,7 @@
18 SET(COVERAGE_REPORT_DIR "${CMAKE_BINARY_DIR}/coveragereport")
19 SET(COVERAGE_XML_FILE "${CMAKE_BINARY_DIR}/coverage.xml")
20 SET(COVERAGE_XML_COMMAND_FILE "${CMAKE_BINARY_DIR}/coverage-xml.cmake")
21-
22+
23 # decide if there is any tool to create coverage data
24 SET(TOOL_FOUND FALSE)
25 IF(LCOV_FOUND OR GCOVR_FOUND)
26@@ -59,34 +59,34 @@
27 IF(NOT TOOL_FOUND)
28 MESSAGE(STATUS "Cannot enable coverage targets because neither lcov nor gcovr are found.")
29 ENDIF()
30-
31+
32 IF(CMAKE_COMPILER_IS_GNUCXX AND TOOL_FOUND AND "${enable_coverage}")
33-
34+
35 MESSAGE(STATUS "Coverage support enabled for targets: ${ENABLE_COVERAGE_REPORT_TARGETS}")
36-
37+
38 # create coverage build type
39 SET(CMAKE_CXX_FLAGS_COVERAGE ${CMAKE_CXX_FLAGS_DEBUG} PARENT_SCOPE)
40 SET(CMAKE_C_FLAGS_COVERAGE ${CMAKE_C_FLAGS_DEBUG} PARENT_SCOPE)
41 SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} coverage PARENT_SCOPE)
42-
43+
44 # instrument targets
45 SET_TARGET_PROPERTIES(${ENABLE_COVERAGE_REPORT_TARGETS} PROPERTIES COMPILE_FLAGS --coverage
46 LINK_FLAGS --coverage)
47-
48+
49 # html report
50 IF (LCOV_FOUND)
51-
52+
53 MESSAGE(STATUS "Enabling HTML coverage report")
54-
55+
56 # set up coverage target
57-
58+
59 ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_RAW_FILE}
60 COMMAND ${LCOV_EXECUTABLE} -c -d ${CMAKE_BINARY_DIR} -o ${COVERAGE_RAW_FILE}
61 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
62 COMMENT "Collecting coverage data"
63 DEPENDS ${ENABLE_COVERAGE_REPORT_TARGETS} ${ENABLE_COVERAGE_REPORT_TESTS}
64 VERBATIM)
65-
66+
67 # filter unwanted stuff
68 LIST(LENGTH ENABLE_COVERAGE_REPORT_FILTER FILTER_LENGTH)
69 IF(${FILTER_LENGTH} GREATER 0)
70@@ -98,7 +98,7 @@
71 ELSE()
72 SET(FILTER "")
73 ENDIF()
74-
75+
76 ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_FILTERED_FILE}
77 COMMAND ${LCOV_EXECUTABLE} -e ${COVERAGE_RAW_FILE} "${CMAKE_SOURCE_DIR}*" -o ${COVERAGE_FILTERED_FILE}
78 ${FILTER}
79@@ -111,34 +111,34 @@
80 DEPENDS ${COVERAGE_FILTERED_FILE}
81 COMMENT "Generating HTML coverage report in ${COVERAGE_REPORT_DIR}"
82 VERBATIM)
83-
84+
85 ADD_CUSTOM_TARGET(coverage-html
86 DEPENDS ${COVERAGE_REPORT_DIR})
87-
88+
89 ENDIF()
90-
91+
92 # xml coverage report
93 IF(GCOVR_FOUND)
94-
95+
96 MESSAGE(STATUS "Enabling XML coverage report")
97-
98+
99 # gcovr cannot write directly to a file so the execution needs to
100 # be wrapped in a cmake file that generates the file output
101 FILE(WRITE ${COVERAGE_XML_COMMAND_FILE}
102 "SET(ENV{LANG} en)\n")
103 FILE(APPEND ${COVERAGE_XML_COMMAND_FILE}
104 "EXECUTE_PROCESS(COMMAND \"${GCOVR_EXECUTABLE}\" -x -r \"${CMAKE_SOURCE_DIR}\" OUTPUT_FILE \"${COVERAGE_XML_FILE}\" WORKING_DIRECTORY \"${CMAKE_BINARY_DIR}\")\n")
105-
106+
107 ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_XML_FILE}
108 COMMAND ${CMAKE_COMMAND} ARGS -P ${COVERAGE_XML_COMMAND_FILE}
109 COMMENT "Generating coverage XML report"
110 VERBATIM)
111-
112+
113 ADD_CUSTOM_TARGET(coverage-xml
114 DEPENDS ${COVERAGE_XML_FILE})
115-
116+
117 ENDIF()
118-
119+
120 # provide a global coverage target executing both steps if available
121 SET(GLOBAL_DEPENDS "")
122 IF(LCOV_FOUND)
123@@ -151,7 +151,7 @@
124 ADD_CUSTOM_TARGET(coverage
125 DEPENDS ${GLOBAL_DEPENDS})
126 ENDIF()
127-
128+
129 ENDIF()
130
131-ENDFUNCTION()
132+ENDFUNCTION()
133
134=== added file 'FindGcovr.cmake'
135--- FindGcovr.cmake 1970-01-01 00:00:00 +0000
136+++ FindGcovr.cmake 2014-05-28 15:24:32 +0000
137@@ -0,0 +1,43 @@
138+# - Find gcovr scrip
139+# Will define:
140+#
141+# GCOVR_EXECUTABLE - the gcovr script
142+#
143+# Uses:
144+#
145+# GCOVR_ROOT - root to search for the script
146+#
147+# Copyright (C) 2011 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
148+#
149+# This file may be licensed under the terms of the
150+# GNU Lesser General Public License Version 3 (the ``LGPL''),
151+# or (at your option) any later version.
152+#
153+# Software distributed under the License is distributed
154+# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
155+# express or implied. See the LGPL for the specific language
156+# governing rights and limitations.
157+#
158+# You should have received a copy of the LGPL along with this
159+# program. If not, go to http://www.gnu.org/licenses/lgpl.html
160+# or write to the Free Software Foundation, Inc.,
161+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
162+#
163+# The development of this software was supported by:
164+# CoR-Lab, Research Institute for Cognition and Robotics
165+# Bielefeld University
166+
167+INCLUDE(FindPackageHandleStandardArgs)
168+
169+FIND_PROGRAM(GCOVR_EXECUTABLE gcovr
170+ HINTS ${GCOVR_ROOT}
171+ "${GCOVR_ROOT}/bin"
172+ "${GCOVR_ROOT}/share/python"
173+ "/usr/share/python"
174+ "/usr/local/share/python"
175+ "${CMAKE_INSTALL_PREFIX}/share/python")
176+
177+FIND_PACKAGE_HANDLE_STANDARD_ARGS(gcovr DEFAULT_MSG GCOVR_EXECUTABLE)
178+
179+# only visible in advanced view
180+MARK_AS_ADVANCED(GCOVR_EXECUTABLE)
181
182=== removed file 'Findgcovr.cmake'
183--- Findgcovr.cmake 2014-05-27 12:26:14 +0000
184+++ Findgcovr.cmake 1970-01-01 00:00:00 +0000
185@@ -1,43 +0,0 @@
186-# - Find gcovr scrip
187-# Will define:
188-#
189-# GCOVR_EXECUTABLE - the gcovr script
190-#
191-# Uses:
192-#
193-# GCOVR_ROOT - root to search for the script
194-#
195-# Copyright (C) 2011 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
196-#
197-# This file may be licensed under the terms of the
198-# GNU Lesser General Public License Version 3 (the ``LGPL''),
199-# or (at your option) any later version.
200-#
201-# Software distributed under the License is distributed
202-# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
203-# express or implied. See the LGPL for the specific language
204-# governing rights and limitations.
205-#
206-# You should have received a copy of the LGPL along with this
207-# program. If not, go to http://www.gnu.org/licenses/lgpl.html
208-# or write to the Free Software Foundation, Inc.,
209-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
210-#
211-# The development of this software was supported by:
212-# CoR-Lab, Research Institute for Cognition and Robotics
213-# Bielefeld University
214-
215-INCLUDE(FindPackageHandleStandardArgs)
216-
217-FIND_PROGRAM(GCOVR_EXECUTABLE gcovr
218- HINTS ${GCOVR_ROOT}
219- "${GCOVR_ROOT}/bin"
220- "${GCOVR_ROOT}/share/python"
221- "/usr/share/python"
222- "/usr/local/share/python"
223- "${CMAKE_INSTALL_PREFIX}/share/python")
224-
225-FIND_PACKAGE_HANDLE_STANDARD_ARGS(gcovr DEFAULT_MSG GCOVR_EXECUTABLE)
226-
227-# only visible in advanced view
228-MARK_AS_ADVANCED(GCOVR_EXECUTABLE)

Subscribers

People subscribed via source and target branches

to all changes: