Skip to content

Commit

Permalink
💩 Disable clang-tidy on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kammce committed Apr 2, 2024
1 parent 9b296ab commit 8e13fec
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
41 changes: 24 additions & 17 deletions cmake/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,36 @@ add_custom_target(copy_compile_commands ALL
# Colored LIBHAL text
set(LIBHAL_TITLE "${BoldMagenta}[LIBHAL]:${ColourReset}")

# Find clang-tidy-17
find_program(LIBHAL_CLANG_TIDY_PROGRAM NAMES "clang-tidy-17" DOC
"Path to clang-tidy executable")

if(NOT LIBHAL_CLANG_TIDY_PROGRAM)
message(STATUS "${LIBHAL_TITLE} clang-tidy not found.")
if(WIN32)
# Disable clang-tidy for Windows builds
set(CMAKE_CXX_CLANG_TIDY "")
else()
# Set clang-tidy as a CXX language standard option
message(STATUS "${LIBHAL_TITLE} clang-tidy-17 AVAILABLE!")
set(LIBHAL_CLANG_TIDY_CONFIG_FILE
"${LIBHAL_SCRIPT_PATH}/clang-tidy.conf")
set(LIBHAL_CLANG_TIDY "${LIBHAL_CLANG_TIDY_PROGRAM}"
"--config-file=${LIBHAL_CLANG_TIDY_CONFIG_FILE}")
# Find clang-tidy-17
find_program(LIBHAL_CLANG_TIDY_PROGRAM NAMES "clang-tidy-17" DOC
"Path to clang-tidy executable")

if(NOT LIBHAL_CLANG_TIDY_PROGRAM)
message(STATUS "${LIBHAL_TITLE} clang-tidy not found.")
else()
# Set clang-tidy as a CXX language standard option
message(STATUS "${LIBHAL_TITLE} clang-tidy-17 AVAILABLE!")
set(LIBHAL_CLANG_TIDY_CONFIG_FILE
"${LIBHAL_SCRIPT_PATH}/clang-tidy.conf")
set(LIBHAL_CLANG_TIDY "${LIBHAL_CLANG_TIDY_PROGRAM}"
"--config-file=${LIBHAL_CLANG_TIDY_CONFIG_FILE}")
endif()
endif()

# Adds clang tidy check to target for host builds (skipped if a cross build)
function(_libhal_add_clang_tidy_check TARGET)
if(NOT ${CMAKE_CROSSCOMPILING})
set(CMAKE_CXX_CLANG_TIDY ${LIBHAL_CLANG_TIDY_PROGRAM})
set_target_properties(${TARGET} PROPERTIES CXX_CLANG_TIDY
"${LIBHAL_CLANG_TIDY}")
else()
if(${CMAKE_CROSSCOMPILING})
message(STATUS "${LIBHAL_TITLE} Cross compiling, skipping clang-tidy checks for \"${TARGET}\"")
elseif(WIN32)
message(STATUS "${LIBHAL_TITLE} Windows has issues with clang-tidy, skipping clang-tidy checks for \"${TARGET}\"")
else()
set(CMAKE_CXX_CLANG_TIDY ${LIBHAL_CLANG_TIDY_PROGRAM})
set_target_properties(${TARGET} PROPERTIES CXX_CLANG_TIDY
"${LIBHAL_CLANG_TIDY}")
endif()
endfunction()

Expand Down
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class libhal_cmake_util_conan(ConanFile):
name = "libhal-cmake-util"
version = "4.1.0"
version = "4.1.1"
license = "Apache-2.0"
homepage = "https://libhal.github.io/libhal-armcortex"
description = ("A collection of CMake scripts for ARM Cortex ")
Expand Down

0 comments on commit 8e13fec

Please sign in to comment.