From 0f2a5b431972ba244e4171d8fd366c480e3a43f3 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Sat, 14 Mar 2026 11:00:36 +0000 Subject: [PATCH] Add clang flags (untested) --- CMakeLists.txt | 12 +++++++++++- Minecraft.Client/CMakeLists.txt | 3 +++ Minecraft.World/CMakeLists.txt | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index edfc61bcc..ae8130289 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,9 +30,19 @@ function(configure_msvc_target target) $<$:/EHsc> $<$:/GR> $<$,$>:/Od> - $<$,$>:/GL /O2 /Oi /GT /GF /Ob3> + $<$,$>:/GL /O2 /Oi /GT /GF> ) endfunction() +function(configure_clang_target target) + target_compile_options(${target} PRIVATE + $<$,$>:-O0 -Wall> + $<$,$>:-O2 -w -flto> + ) + target_link_options(${target} PRIVATE + $<$:-flto> + ) +endfunction() + # --- # Configuration diff --git a/Minecraft.Client/CMakeLists.txt b/Minecraft.Client/CMakeLists.txt index 4e4116190..1724f4a2c 100644 --- a/Minecraft.Client/CMakeLists.txt +++ b/Minecraft.Client/CMakeLists.txt @@ -45,6 +45,9 @@ if(MSVC) $<$:/LTCG:incremental> ) endif() +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + configure_clang_target(Minecraft.Client) +endif() set_target_properties(Minecraft.Client PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/$" diff --git a/Minecraft.World/CMakeLists.txt b/Minecraft.World/CMakeLists.txt index caf6d0bf2..24cf7f9bd 100644 --- a/Minecraft.World/CMakeLists.txt +++ b/Minecraft.World/CMakeLists.txt @@ -29,3 +29,6 @@ target_precompile_headers(Minecraft.World PRIVATE "$<$:std if(MSVC) configure_msvc_target(Minecraft.World) endif() +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + configure_clang_target(Minecraft.World) +endif()