Skip to content

Commit cb27b83

Browse files
authored
Merge pull request #41 from cpp4ever/master
Major compiler version only at llvm-cov-* on Ubuntu
2 parents a941c27 + 8c62b61 commit cb27b83

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cmake/FindGcov.cmake

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,18 @@ foreach (LANG ${ENABLED_LANGUAGES})
3737

3838
elseif ("${CMAKE_${LANG}_COMPILER_ID}" MATCHES "^(Apple)?Clang$")
3939
# Some distributions like Debian ship llvm-cov with the compiler
40-
# version appended as llvm-cov-x.y. To find this binary we'll build
40+
# version appended as llvm-cov-x.y or just llvm-cov-x. To find this binary we'll build
4141
# the suggested binary name with the compiler version.
42-
string(REGEX MATCH "^[0-9]+.[0-9]+" LLVM_VERSION
42+
string(REGEX MATCH "^[0-9]+\.[0-9]+" LLVM_FULL_VERSION
43+
"${CMAKE_${LANG}_COMPILER_VERSION}")
44+
string(REGEX MATCH "^[0-9]+" LLVM_MAJOR_VERSION
4345
"${CMAKE_${LANG}_COMPILER_VERSION}")
4446

4547
# llvm-cov prior version 3.5 seems to be not working with coverage
4648
# evaluation tools, but these versions are compatible with the gcc
4749
# gcov tool.
48-
if(LLVM_VERSION VERSION_GREATER 3.4)
49-
find_program(LLVM_COV_BIN NAMES "llvm-cov-${LLVM_VERSION}"
50+
if(LLVM_FULL_VERSION VERSION_GREATER 3.4)
51+
find_program(LLVM_COV_BIN NAMES "llvm-cov-${LLVM_FULL_VERSION}" "llvm-cov-${LLVM_MAJOR_VERSION}"
5052
"llvm-cov" HINTS ${COMPILER_PATH})
5153
mark_as_advanced(LLVM_COV_BIN)
5254

0 commit comments

Comments
 (0)