bool FixSDL2() { const std::string File = "C:/Engine/SDL2/CMakeLists.txt"; std::string Buffer; if(!FileToBuffer(File, Buffer) || Buffer.empty())return false; StringReplaceByString(Buffer, "list(APPEND EXTRA_LIBS ${COREVIDEO})", ""); //XCode links frameworks automatically now StringReplaceByString(Buffer, "list(APPEND EXTRA_LIBS ${COCOA_LIBRARY})", ""); StringReplaceByString(Buffer, "list(APPEND EXTRA_LIBS ${IOKIT})", ""); StringReplaceByString(Buffer, "list(APPEND EXTRA_LIBS ${FORCEFEEDBACK})", ""); StringReplaceByString(Buffer, "list(APPEND EXTRA_LIBS ${CARBON_LIBRARY})", ""); StringReplaceByString(Buffer, "list(APPEND EXTRA_LIBS ${COREAUDIO})", ""); StringReplaceByString(Buffer, "list(APPEND EXTRA_LIBS ${AUDIOTOOLBOX})", ""); StringReplaceByString(Buffer, //http://stackoverflow.com/questions/26971333/what-is-clangs-equivalent-to-no-undefined-gcc-flag, on linux the undefined thing is ok? so we need switch case like this: "list(APPEND EXTRA_LDFLAGS \"-Wl,--no-undefined\")", "if(APPLE)\nlist(APPEND EXTRA_LDFLAGS \"-Wl,-undefined,error\")\nelse()\nlist(APPEND EXTRA_LDFLAGS \"-Wl,--no-undefined\")\nendif()"); if(!BufferToFile(File, Buffer))return false; return true; }