diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0b9c6c57b..7b16b8f4d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,16 +3,20 @@ add_definitions(-DHAVE_CONFIG_H) +###################################################################### +# Compiler-specific flags + if(MSVC) # Do not link with libcmt.lib (to avoid duplicated symbols with msvcrtd.lib) if(CMAKE_BUILD_TYPE STREQUAL Debug) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:LIBCMT") endif() - # Add support for Windows XP if (CMAKE_SIZEOF_VOID_P EQUAL 8) + # 64 bits set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MACHINE:X64") else() + # Add support for Windows XP with 5.01 subsystem set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MACHINE:X86 /SUBSYSTEM:WINDOWS,5.01") endif() endif(MSVC) @@ -166,6 +170,13 @@ else() set(libs3rdparty ${libs3rdparty} allegro) endif() +###################################################################### +# Add C++11 support only for our code (avoid Allegro) + +if(UNIX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++11") +endif() + ###################################################################### # Aseprite Libraries (in preferred order to be built) diff --git a/src/app/app.cpp b/src/app/app.cpp index 236aa839a..69dfd5fe6 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -215,22 +215,19 @@ int App::run() { UIContext* context = UIContext::instance(); Console console; - for (FileList::iterator - it = m_files.begin(), - end = m_files.end(); - it != end; ++it) { + for (const std::string& filename : m_files) { // Load the sprite - Document* document = load_document(context, it->c_str()); + Document* document = load_document(context, filename.c_str()); if (!document) { if (!isGui()) - console.printf("Error loading file \"%s\"\n", it->c_str()); + console.printf("Error loading file \"%s\"\n", filename.c_str()); } else { // Add the given file in the argument as a "recent file" only // if we are running in GUI mode. If the program is executed // in batch mode this is not desirable. if (isGui()) - getRecentFiles()->addRecentFile(it->c_str()); + getRecentFiles()->addRecentFile(filename.c_str()); // Add the document to the exporter. if (m_exporter != NULL)