From 894eea12de201603290dd08210f6449cad143bcf Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Fri, 30 Jun 2023 22:02:27 +0200 Subject: [PATCH] Only force multiple when build in Debug Debug only, required for reliable '_xxxx_dbg' CRT allocator function overrides. --- r5dev/core/CMakeLists.txt | 10 ++++++++++ r5dev/pluginsdk/CMakeLists.txt | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/r5dev/core/CMakeLists.txt b/r5dev/core/CMakeLists.txt index 45bf563b..f074d6d5 100644 --- a/r5dev/core/CMakeLists.txt +++ b/r5dev/core/CMakeLists.txt @@ -124,6 +124,16 @@ endif() target_link_options( ${PROJECT_NAME} PRIVATE "/STACK:8000000" # Match game executable stack reserve size + + # The only reason this has to be done, is because + # the _xxxx_dbg malloc functions could otherwise + # throw a linker error, as they are already defined + # in the CRT library, but there doesn't seem to be + # a standard way to override these, unlike the + # _xxxx_base malloc functions. Since this is only + # relevant for debug builds, this linker flag should + # only be toggled for DEBUG!!! + $<$:/FORCE:MULTIPLE> ) add_custom_command( TARGET ${PROJECT_NAME} POST_BUILD diff --git a/r5dev/pluginsdk/CMakeLists.txt b/r5dev/pluginsdk/CMakeLists.txt index 418fa0ee..8e45621c 100644 --- a/r5dev/pluginsdk/CMakeLists.txt +++ b/r5dev/pluginsdk/CMakeLists.txt @@ -37,6 +37,6 @@ target_link_options( ${PROJECT_NAME} PRIVATE # a standard way to override these, unlike the # _xxxx_base malloc functions. Since this is only # relevant for debug builds, this linker flag should - # only be toggled for DEBUG builds!!! - "/FORCE:MULTIPLE" + # only be toggled for DEBUG!!! + $<$:/FORCE:MULTIPLE> )