From 95eda37e4792ed276ca3e71addabee364406d844 Mon Sep 17 00:00:00 2001 From: LaurentGom Date: Mon, 8 Nov 2010 22:22:17 +0000 Subject: [PATCH] Fixed crash when saving PNG images with gcc git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1628 4e206d99-4929-0410-ac5d-dfc041789085 --- 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 9c20ecc5..585ecb57 100644 --- a/src/SFML/Graphics/CMakeLists.txt +++ b/src/SFML/Graphics/CMakeLists.txt @@ -97,6 +97,12 @@ endif() # add preprocessor symbols add_definitions(-DGLEW_STATIC -DSTBI_FAILURE_USERMSG) +# ImageLoader.cpp must be compiled with the -fno-strict-aliasing +# when gcc is used; otherwise saving PNGs may crash in stb_image_write +if(COMPILER_GCC) + set_source_files_properties(${SRCROOT}/ImageLoader.cpp PROPERTIES COMPILE_FLAGS -fno-strict-aliasing) +endif() + # define the sfml-graphics target sfml_add_library(sfml-graphics SOURCES ${SRC}