Compile subprojects with C++11 flags

This commit is contained in:
David Capello 2014-08-15 00:26:27 -03:00
parent 9d675b6864
commit 897513264d
3 changed files with 36 additions and 35 deletions

View File

@ -33,6 +33,30 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
# Third-party libraries
if(USE_SHARED_ALLEGRO4)
# Find the shared Allegro 4 library
find_library(LIBALLEGRO4_LIBRARY alleg)
find_path(LIBALLEGRO4_INCLUDE_DIR allegro.h)
if(NOT LIBALLEGRO4_LIBRARY)
message(FATAL_ERROR "Allegro 4 not found")
endif()
# Get flags to link programs using allegro-config program
execute_process(COMMAND allegro-config --libs --shared
OUTPUT_VARIABLE LIBALLEGRO4_LINK_FLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
include_directories(${LIBALLEGRO4_INCLUDE_DIR})
else()
add_definitions(-DALLEGRO4_WITH_RESIZE_PATCH)
add_definitions(-DALLEGRO4_WITH_EXTRA_CURSORS)
# Use patched version of Allegro 4 (with window resize support).
add_subdirectory(allegro)
set(libs3rdparty ${libs3rdparty} allegro)
endif()
if(USE_SHARED_JPEGLIB)
find_package(JPEG)
if(JPEG_FOUND)
@ -99,6 +123,16 @@ else()
include_directories(${LOADPNG_DIR})
endif()
######################################################################
# Add C++11 support only for our code (avoid Allegro)
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-switch -std=gnu++11")
endif()
######################################################################
# Updater
if (CMAKE_USE_PTHREADS_INIT)
set(sys_libs ${sys_libs} ${CMAKE_THREAD_LIBS_INIT})
endif()
@ -146,37 +180,6 @@ else()
add_definitions(-DENABLE_TRIAL_MODE)
endif()
if(USE_SHARED_ALLEGRO4)
# Find the shared Allegro 4 library
find_library(LIBALLEGRO4_LIBRARY alleg)
find_path(LIBALLEGRO4_INCLUDE_DIR allegro.h)
if(NOT LIBALLEGRO4_LIBRARY)
message(FATAL_ERROR "Allegro 4 not found")
endif()
# Get flags to link programs using allegro-config program
execute_process(COMMAND allegro-config --libs --shared
OUTPUT_VARIABLE LIBALLEGRO4_LINK_FLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
include_directories(${LIBALLEGRO4_INCLUDE_DIR})
else()
add_definitions(-DALLEGRO4_WITH_RESIZE_PATCH)
add_definitions(-DALLEGRO4_WITH_EXTRA_CURSORS)
# Use patched version of Allegro 4 (with window resize support).
add_subdirectory(allegro)
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)

View File

@ -7,10 +7,8 @@ set(UPDATER_LIB_SOURCES
if(WIN32)
set(UPDATER_LIB_SOURCES ${UPDATER_LIB_SOURCES} user_agent_win.c)
else()
if(APPLE)
set(UPDATER_LIB_SOURCES ${UPDATER_LIB_SOURCES} user_agent_mac.m)
endif()
elseif(APPLE)
set(UPDATER_LIB_SOURCES ${UPDATER_LIB_SOURCES} user_agent_mac.mm)
endif()
add_library(updater-lib ${UPDATER_LIB_SOURCES})