Commit 6d651691 authored by James's avatar James
Browse files

Add mechanism to disable Clang formatting

parent b200c7f2
......@@ -26,6 +26,8 @@ option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF)
option(ENABLE_SCRIPTING "Enables scripting support" ON)
option(DISABLE_CLANG_TARGET "Disables the Clang format check" ON)
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/.git/hooks/pre-commit)
message(STATUS "Copying pre-commit hook")
file(COPY hooks/pre-commit
......@@ -310,7 +312,7 @@ find_program(CLANG_FORMAT
clang-format
PATHS ${CMAKE_BINARY_DIR}/externals)
# if find_program doesn't find it, try to download from externals
if (NOT CLANG_FORMAT)
if (NOT CLANG_FORMAT AND NOT DISABLE_CLANG_TARGET)
if (WIN32)
message(STATUS "Clang format not found! Downloading...")
set(CLANG_FORMAT "${CMAKE_BINARY_DIR}/externals/clang-format${CLANG_FORMAT_POSTFIX}.exe")
......@@ -328,7 +330,7 @@ if (NOT CLANG_FORMAT)
endif()
endif()
if (CLANG_FORMAT)
if (CLANG_FORMAT AND NOT DISABLE_CLANG_TARGET)
set(SRCS ${CMAKE_SOURCE_DIR}/src)
set(CCOMMENT "Running clang format against all the .h and .cpp files in src/")
if (WIN32)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment