From e52b4ea4fdbea4e8778978367c6adec6fcde9c83 Mon Sep 17 00:00:00 2001 From: ytnuf <161308826+ytnuf@users.noreply.github.com> Date: Tue, 13 Aug 2024 19:44:39 +0100 Subject: [PATCH] Add hot reload support when building with GCC and CMake (cherry picked from commit 05571971cc4b57f34c1fce180c2df20750c5bc90) --- CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96090611..af62675a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,10 +124,6 @@ else() endif() endif() -if (GODOT_ENABLE_HOT_RELOAD) - set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -D HOT_RELOAD_ENABLED") -endif() - # Generate source from the bindings file find_package(Python3 3.4 REQUIRED) # pathlib should be present if(GENERATE_TEMPLATE_GET_NODE) @@ -170,6 +166,11 @@ target_compile_features(${PROJECT_NAME} cxx_std_17 ) +if(GODOT_ENABLE_HOT_RELOAD) + target_compile_definitions(${PROJECT_NAME} PUBLIC HOT_RELOAD_ENABLED) + target_compile_options(${PROJECT_NAME} PUBLIC $<${compiler_is_gnu}:-fno-gnu-unique>) +endif() + target_compile_definitions(${PROJECT_NAME} PUBLIC $<$: DEBUG_ENABLED