From 435cebb80e4d2367c3a8445f993c08d02178f4c5 Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 25 Aug 2010 16:20:30 -0300 Subject: [PATCH] Move common definitions in cflags to the main CMakeLists.txt file. --- CMakeLists.txt | 37 ++++++++++++++++++++++++++++++++- src/CMakeLists.txt | 2 -- third_party/vaca/CMakeLists.txt | 3 --- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ee63ac45..59aaa1e86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,10 +3,20 @@ cmake_minimum_required(VERSION 2.6) +###################################################################### # Global project name + project(aseprite) +###################################################################### +# Options (these can be specified in cmake command line or modifying CMakeCache.txt) + +option(USE_STATIC_LIBC "Use static version of C and C++ runtimes" off) +option(USE_STATIC_ALLEGRO "Use static version of Allegro library" off) + +###################################################################### # Directories of third-party libraries + set(LIBFREETYPE_DIR ${CMAKE_SOURCE_DIR}/third_party/freetype) set(LIBJPEG_DIR ${CMAKE_SOURCE_DIR}/third_party/jpeg) set(LIBPNG_DIR ${CMAKE_SOURCE_DIR}/third_party/libpng) @@ -15,8 +25,33 @@ set(TINYXML_DIR ${CMAKE_SOURCE_DIR}/third_party/tinyxml) set(VACA_DIR ${CMAKE_SOURCE_DIR}/third_party/vaca) set(ZLIB_DIR ${CMAKE_SOURCE_DIR}/third_party/zlib) -# aseprite program +###################################################################### +# Common definitions to compile all sources + +# Vaca is compiled with Allegro +add_definitions(-DVACA_ALLEGRO) + +# Do not use MMX optimizations in PNG code +add_definitions(-DPNG_NO_MMX_CODE) + +# Debug C/C++ flags +if(CMAKE_BUILD_TYPE STREQUAL Debug) + add_definitions(-DDEBUGMODE -D_DEBUG) +else() + add_definitions(-DNDEBUG) +endif() + +# Use static Allegro library +if(USE_STATIC_ALLEGRO) + add_definitions(-DALLEGRO_STATICLINK) +endif() + +###################################################################### +# Main ASE targets + add_subdirectory(src) +###################################################################### # Third party libraries + add_subdirectory(third_party) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ac04981eb..3f705204e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -267,5 +267,3 @@ if(MSVC) endif(CMAKE_BUILD_TYPE STREQUAL Debug) endif(MSVC) -set_target_properties(aseprite PROPERTIES - COMPILE_FLAGS "-DVACA_ALLEGRO -DDEBUGMODE -DALLEGRO_STATICLINK") diff --git a/third_party/vaca/CMakeLists.txt b/third_party/vaca/CMakeLists.txt index 9bcbb3ef9..a1ecba26a 100644 --- a/third_party/vaca/CMakeLists.txt +++ b/third_party/vaca/CMakeLists.txt @@ -18,6 +18,3 @@ add_library(vaca src/Size.cpp src/String.cpp src/Vaca.cpp) - -set_target_properties(vaca PROPERTIES - COMPILE_FLAGS "-DVACA_ALLEGRO -DDEBUGMODE -DALLEGRO_STATICLINK")