Re-organize some compiler flags

This commit is contained in:
David Capello 2018-03-13 09:56:23 -03:00
parent 3187992a20
commit 12578321d6
2 changed files with 15 additions and 18 deletions

View File

@ -1,5 +1,5 @@
# Aseprite
# Copyright (C) 2001-2017 David Capello
# Copyright (C) 2001-2018 David Capello
#
# Parts of this file come from the Allegro 4.4 CMakeLists.txt
@ -180,12 +180,15 @@ else()
add_definitions(-DNDEBUG)
endif()
if(NOT WIN32 AND NOT APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu89")
endif()
if(APPLE AND USE_SKIA_BACKEND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
elseif(UNIX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu89")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
endif()
if(NOT USE_SHARED_CURL)

View File

@ -4,6 +4,11 @@
######################################################################
# Compiler-specific flags
if(UNIX)
# All warnings except for switch cases with missing enum items
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-switch")
endif()
if(MSVC)
# As Skia is compiled with /GL flag (whole program optimization),
# the linker prefer a /LTCG parameter to improve link times.
@ -33,17 +38,6 @@ if(USE_ALLEG4_BACKEND AND NOT USE_SHARED_ALLEGRO4)
add_subdirectory(allegro)
endif()
######################################################################
# Add C++11 support only for our code (avoid Allegro)
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-switch")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
endif()
######################################################################
# pthread