From 686ad72e031bdb333156c3ef098215f69d3cf5d6 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Mon, 22 Dec 2025 04:11:12 -0500 Subject: [PATCH] build: add `clang-format` target Through the power of CMake itself, we can format our files Signed-off-by: Seth Flynn --- launcher/CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index a608abfeb..67157a405 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -1625,3 +1625,15 @@ if(WIN32 OR (UNIX AND APPLE)) COMPONENT bundle ) endif() + +find_program(CLANG_FORMAT clang-format OPTIONAL) +if(CLANG_FORMAT) + message(STATUS "Creating clang-format target") + add_custom_target( + clang-format + COMMAND ${CLANG_FORMAT} -i --style=file:${CMAKE_SOURCE_DIR}/.clang-format ${LOGIC_SOURCES} ${LAUNCHER_SOURCES} ${PRISMUPDATER_SOURCES} ${LINKEXE_SOURCES} ${PRECOMPILED_HEADERS} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + ) +else() + message(WARNING "Unable to find `clang-format`. Not creating custom target") +endif()