Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6227ddf5df | |||
| 8df5eaa4e8 |
Vendored
+12
-2
@@ -21,13 +21,23 @@ if (ENABLE_COVERAGE)
|
|||||||
find_program(GCOVR_EXE gcovr REQUIRED)
|
find_program(GCOVR_EXE gcovr REQUIRED)
|
||||||
|
|
||||||
if (CMAKE_C_COMPILER_ID MATCHES "Clang")
|
if (CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
find_program(LLVM_COV_EXE llvm-cov REQUIRED)
|
|
||||||
# gcovr needs a single-token gcov executable. Wrap llvm-cov gcov in a
|
# gcovr needs a single-token gcov executable. Wrap llvm-cov gcov in a
|
||||||
# script placed in the build dir (guaranteed no spaces in path).
|
# script placed in the build dir (guaranteed no spaces in path).
|
||||||
|
# AppleClang ships llvm-cov inside Xcode, reached only via xcrun.
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
|
find_program(LLVM_COV_EXE llvm-cov REQUIRED)
|
||||||
set(GCOV_EXECUTABLE "${CMAKE_BINARY_DIR}/llvm-gcov.bat")
|
set(GCOV_EXECUTABLE "${CMAKE_BINARY_DIR}/llvm-gcov.bat")
|
||||||
file(WRITE "${GCOV_EXECUTABLE}" "@echo off\r\n\"${LLVM_COV_EXE}\" gcov %*\r\n")
|
file(WRITE "${GCOV_EXECUTABLE}" "@echo off\r\n\"${LLVM_COV_EXE}\" gcov %*\r\n")
|
||||||
|
elseif (CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
|
||||||
|
find_program(XCRUN_EXE xcrun REQUIRED)
|
||||||
|
set(GCOV_EXECUTABLE "${CMAKE_BINARY_DIR}/llvm-gcov.sh")
|
||||||
|
file(WRITE "${GCOV_EXECUTABLE}" "#!/bin/sh\nexec xcrun llvm-cov gcov \"$@\"\n")
|
||||||
|
file(CHMOD "${GCOV_EXECUTABLE}"
|
||||||
|
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||||
|
GROUP_READ GROUP_EXECUTE
|
||||||
|
WORLD_READ WORLD_EXECUTE)
|
||||||
else()
|
else()
|
||||||
|
find_program(LLVM_COV_EXE llvm-cov REQUIRED)
|
||||||
set(GCOV_EXECUTABLE "${CMAKE_BINARY_DIR}/llvm-gcov.sh")
|
set(GCOV_EXECUTABLE "${CMAKE_BINARY_DIR}/llvm-gcov.sh")
|
||||||
file(WRITE "${GCOV_EXECUTABLE}" "#!/bin/sh\nexec \"${LLVM_COV_EXE}\" gcov \"$@\"\n")
|
file(WRITE "${GCOV_EXECUTABLE}" "#!/bin/sh\nexec \"${LLVM_COV_EXE}\" gcov \"$@\"\n")
|
||||||
file(CHMOD "${GCOV_EXECUTABLE}"
|
file(CHMOD "${GCOV_EXECUTABLE}"
|
||||||
@@ -35,7 +45,7 @@ if (ENABLE_COVERAGE)
|
|||||||
GROUP_READ GROUP_EXECUTE
|
GROUP_READ GROUP_EXECUTE
|
||||||
WORLD_READ WORLD_EXECUTE)
|
WORLD_READ WORLD_EXECUTE)
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "Coverage: enabled (gcovr: ${GCOVR_EXE}, gcov: ${LLVM_COV_EXE} gcov)")
|
message(STATUS "Coverage: enabled (gcovr: ${GCOVR_EXE}, gcov: llvm-cov gcov)")
|
||||||
else()
|
else()
|
||||||
set(GCOV_EXECUTABLE "gcov")
|
set(GCOV_EXECUTABLE "gcov")
|
||||||
message(STATUS "Coverage: enabled (gcovr: ${GCOVR_EXE})")
|
message(STATUS "Coverage: enabled (gcovr: ${GCOVR_EXE})")
|
||||||
|
|||||||
Vendored
+7
-5
@@ -36,6 +36,13 @@ FetchContent_Declare(
|
|||||||
|
|
||||||
FetchContent_MakeAvailable(unity)
|
FetchContent_MakeAvailable(unity)
|
||||||
|
|
||||||
|
# Unity sets INTERFACE_SYSTEM_INCLUDE_DIRECTORIES to a path inside the build
|
||||||
|
# tree, which CMake rejects on newer versions. The path stays in
|
||||||
|
# INTERFACE_INCLUDE_DIRECTORIES so headers are still found.
|
||||||
|
if (TARGET unity)
|
||||||
|
set_target_properties(unity PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "")
|
||||||
|
endif()
|
||||||
|
|
||||||
if (NOT TARGET Unity::Unity)
|
if (NOT TARGET Unity::Unity)
|
||||||
if (TARGET unity)
|
if (TARGET unity)
|
||||||
add_library(Unity::Unity ALIAS unity)
|
add_library(Unity::Unity ALIAS unity)
|
||||||
@@ -49,11 +56,6 @@ set(Unity_LIBRARIES Unity::Unity)
|
|||||||
set(Unity_VERSION "${UNITY_VERSION}")
|
set(Unity_VERSION "${UNITY_VERSION}")
|
||||||
set(Unity_INCLUDE_DIR "${unity_SOURCE_DIR}/src")
|
set(Unity_INCLUDE_DIR "${unity_SOURCE_DIR}/src")
|
||||||
|
|
||||||
if (Unity_INCLUDE_DIR AND TARGET unity)
|
|
||||||
set_target_properties(unity PROPERTIES
|
|
||||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Unity_INCLUDE_DIR}"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (TARGET unity)
|
if (TARGET unity)
|
||||||
target_compile_definitions(unity PUBLIC
|
target_compile_definitions(unity PUBLIC
|
||||||
|
|||||||
Reference in New Issue
Block a user