Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💩 Disable clang-tidy on Windows #15

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading