Skip to content

Commit

Permalink
GH-43 More cmake fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Dec 30, 2023
1 parent 0e4b249 commit 1bc36d9
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions cmake/clang-format.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,30 @@

find_program(CLANG_FORMAT_PROGRAM NAMES clang-format)

if (CLANG_FORMAT_PROGRAM)
execute_process(
COMMAND "${CLANG_FORMAT_PROGRAM}" --version
OUTPUT_VARIABLE CLANG_FORMAT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)

message("Using clang-format: ${CLANG_FORMAT_PROGRAM} (${CLANG_FORMAT_VERSION})")

file(GLOB_RECURSE
format_src_list
RELATIVE
"${CMAKE_CURRENT_SOURCE_DIR}"
"src/*.[hc]"
"src/*.[hc]pp"
)

foreach (_src_file ${format_src_list})
message(" formatting => ${_src_file}")
execute_process(
COMMAND "${CLANG_FORMAT_PROGRAM}" --style=file -i "${_src_file}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
endforeach ()

unset(CLANG_FORMAT_VERSION)
endif ()
#if (CLANG_FORMAT_PROGRAM)
# execute_process(
# COMMAND "${CLANG_FORMAT_PROGRAM}" --version
# OUTPUT_VARIABLE CLANG_FORMAT_VERSION
# OUTPUT_STRIP_TRAILING_WHITESPACE
# )
#
# message("Using clang-format: ${CLANG_FORMAT_PROGRAM} (${CLANG_FORMAT_VERSION})")
#
# file(GLOB_RECURSE
# format_src_list
# RELATIVE
# "${CMAKE_CURRENT_SOURCE_DIR}"
# "src/*.[hc]"
# "src/*.[hc]pp"
# )
#
# foreach (_src_file ${format_src_list})
# message(" formatting => ${_src_file}")
# execute_process(
# COMMAND "${CLANG_FORMAT_PROGRAM}" --style=file -i "${_src_file}"
# WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
# )
# endforeach ()
#
# unset(CLANG_FORMAT_VERSION)
#endif ()

0 comments on commit 1bc36d9

Please sign in to comment.