From a61d47145126a75c5df60ae3a464246f280ee614 Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Sat, 31 Oct 2020 11:59:06 +0100 Subject: [PATCH] Link legacy_stdio_definitions.lib on MSVC -- fixes linker errors for sprintf() & Co. --- src/SFML/Graphics/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/SFML/Graphics/CMakeLists.txt b/src/SFML/Graphics/CMakeLists.txt index 14c48ea9..36c0a908 100644 --- a/src/SFML/Graphics/CMakeLists.txt +++ b/src/SFML/Graphics/CMakeLists.txt @@ -117,6 +117,12 @@ elseif(SFML_OS_IOS) target_link_libraries(sfml-graphics PRIVATE z bz2) endif() +# on newer MSVC versions, inline versions of some C functions are used; for compatibility link this library +# see https://docs.microsoft.com/en-us/cpp/porting/overview-of-potential-upgrade-issues-visual-cpp?view=msvc-160#libraries +if(SFML_COMPILER_MSVC) + target_link_libraries(sfml-graphics PRIVATE legacy_stdio_definitions.lib) +endif() + sfml_find_package(Freetype INCLUDE "FREETYPE_INCLUDE_DIRS" LINK "FREETYPE_LIBRARY") target_link_libraries(sfml-graphics PRIVATE Freetype)