@@ -40,15 +40,16 @@ if(WIN32)
4040 # Disable clang-tidy for Windows builds
4141 set (CMAKE_CXX_CLANG_TIDY "" )
4242else ()
43- # Find clang-tidy-17
44- find_program (LIBHAL_CLANG_TIDY_PROGRAM NAMES "clang-tidy-17" DOC
45- "Path to clang-tidy executable" )
43+ # Find clang-tidy "clang-tidy"
44+ find_program (LIBHAL_CLANG_TIDY_PROGRAM
45+ NAMES "clang-tidy" "clang-tidy-17" "clang-tidy-18"
46+ DOC "Path to clang-tidy executable" )
4647
4748 if (NOT LIBHAL_CLANG_TIDY_PROGRAM)
4849 message (STATUS "${LIBHAL_TITLE} clang-tidy not found." )
4950 else ()
5051 # Set clang-tidy as a CXX language standard option
51- message (STATUS "${LIBHAL_TITLE} clang-tidy-17 AVAILABLE!" )
52+ message (STATUS "${LIBHAL_TITLE} clang-tidy AVAILABLE!" )
5253 set (LIBHAL_CLANG_TIDY_CONFIG_FILE
5354 "${LIBHAL_SCRIPT_PATH} /clang-tidy.conf" )
5455 set (LIBHAL_CLANG_TIDY "${LIBHAL_CLANG_TIDY_PROGRAM} "
@@ -97,8 +98,7 @@ function(libhal_make_library)
9798 -Wall
9899 -Wextra
99100 -Wshadow
100- -fexceptions
101- -fno-rtti)
101+ $<$<COMPILE_LANGUAGE:CXX>:-fexceptions -fno-rtti>)
102102 target_link_libraries (${LIBRARY_ARGS_LIBRARY_NAME} PUBLIC
103103 ${LIBRARY_ARGS_LINK_LIBRARIES} )
104104 install (TARGETS ${LIBRARY_ARGS_LIBRARY_NAME} )
@@ -269,8 +269,7 @@ function(libhal_build_demos)
269269 -Wall
270270 -Wextra
271271 -Wshadow
272- -fexceptions
273- -fno-rtti
272+ $<$<COMPILE_LANGUAGE:CXX>:-fexceptions -fno-rtti>
274273 )
275274 target_link_libraries (startup_code PRIVATE
276275 picolibc
@@ -294,8 +293,7 @@ function(libhal_build_demos)
294293 -Wall
295294 -Wextra
296295 -Wshadow
297- -fexceptions
298- -fno-rtti
296+ $<$<COMPILE_LANGUAGE:CXX>:-fexceptions -fno-rtti>
299297 )
300298 target_link_libraries (${elf} PRIVATE
301299 startup_code
@@ -316,4 +314,4 @@ function(libhal_build_demos)
316314 _libhal_add_clang_tidy_check(${elf} )
317315 endif ()
318316 endforeach ()
319- endfunction ()
317+ endfunction ()
0 commit comments