Skip to content

Commit 1fee484

Browse files
jeremybettisnashif
authored andcommitted
cmake: Populate var CMAKE_GCOV
For each compiler, also set a CMAKE_GCOV var referencing the appropriate gcov tool. Tested with gcc and host-gcc on the ChromeOS codebase. Signed-off-by: Jeremy Bettis <[email protected]>
1 parent e9f2388 commit 1fee484

File tree

5 files changed

+7
-0
lines changed

5 files changed

+7
-0
lines changed

cmake/compiler/arcmwdt/generic.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ if(NOT CMAKE_DTS_PREPROCESSOR)
1919
endif()
2020

2121
find_program(CMAKE_C_COMPILER ${CROSS_COMPILE}ccac PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
22+
find_program(CMAKE_LLVM_COV ${CROSS_COMPILE}llvm-cov PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
23+
set(CMAKE_GCOV "${CMAKE_LLVM_COV} gcov")
2224

2325
if(CMAKE_C_COMPILER STREQUAL CMAKE_C_COMPILER-NOTFOUND)
2426
message(FATAL_ERROR "Zephyr was unable to find the Metaware compiler")

cmake/compiler/clang/generic.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ if(DEFINED TOOLCHAIN_HOME)
55
endif()
66

77
find_program(CMAKE_C_COMPILER clang ${find_program_clang_args})
8+
find_program(CMAKE_LLVM_COV llvm-cov ${find_program_clang_args})
9+
set(CMAKE_GCOV "${CMAKE_LLVM_COV} gcov")
810

cmake/compiler/gcc/generic.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
set_ifndef(CC gcc)
44

55
find_program(CMAKE_C_COMPILER ${CROSS_COMPILE}${CC} PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
6+
find_program(CMAKE_GCOV ${CROSS_COMPILE}gcov PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
67

78
if(CMAKE_C_COMPILER STREQUAL CMAKE_C_COMPILER-NOTFOUND)
89
message(FATAL_ERROR "Zephyr was unable to find the toolchain. Is the environment misconfigured?

cmake/compiler/host-gcc/generic.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
# Configures CMake for using GCC
44

55
find_program(CMAKE_C_COMPILER gcc)
6+
find_program(CMAKE_GCOV gcov)

cmake/compiler/xcc/generic.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
set_ifndef(CC gcc)
44

55
find_program(CMAKE_C_COMPILER ${CROSS_COMPILE}${CC} PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
6+
find_program(CMAKE_GCOV ${CROSS_COMPILE}gcov PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
67

78
if(CMAKE_C_COMPILER STREQUAL CMAKE_C_COMPILER-NOTFOUND)
89
message(FATAL_ERROR "Zephyr was unable to find the toolchain. Is the environment misconfigured?

0 commit comments

Comments
 (0)