CMakeLists.txt 1.65 KB
Newer Older
beoran's avatar
beoran committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
cmake_minimum_required(VERSION 2.8)
# Set policy: link_directories is relative to source dir
cmake_policy(SET CMP0015 NEW)


# Set the project name.
project(A4A5 C)

# tell CMake to search first in the cmake subdirectory for FIND_PACKAGE() or INCLUDE()
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/)

include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)


if(CMAKE_COMPILER_IS_GNUCC)
set(COMPILER_GCC 1)
set(CMAKE_C_FLAGS "-W -Wall -Wno-unused -Wno-unknown-pragmas -g3 -gdwarf-2 -std=c99 -ffast-math -fno-omit-frame-pointer -fstrict-aliasing -Wstrict-aliasing=2")
# set(CMAKE_LD_FLAGS "-pg")
# always use gnu99, debugging, all warnings except unused and unknown pragmas.
# when compiling with gnu compiler.  
# Warn about alisasing because otherwise aliasing problems it may not be detected.
else(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "-W -Wall -Wno-unused -Wno-unknown-pragmas -g -std=c99 -ffast-math -fstrict-aliasing -Wstrict-aliasing=2")
endif(CMAKE_COMPILER_IS_GNUCC)


# Finds Allegro using pkgconfig, so it must be configured correctly 
find_package(Allegro5 REQUIRED)
find_package(Allegro4 REQUIRED)

message(ALLEGRO4_INCLUDE_DIR)
message(ALLEGRO5_INCLUDE_DIR)
message(ALLEGRO4_LIBRARIES)
message(ALLEGRO5_LIBRARIES)

# Set include and lib dirs. 
include_directories(${ALLEGRO4_INCLUDE_DIR} ${ALLEGRO5_INCLUDE_DIR})

set(A4A5_LIBS ${LIBS} ${ALLEGRO4_LIBRARIES} ${ALLEGRO5_LIBRARIES})

include_directories("include")

# add_subdirectory("src")
include(A4A5Files)
set_source_files_properties(${ERUTA_SRC_FILES} PROPERTIES LANGUAGE C)

add_library(a4a5 ${A4A5_SRC_FILES})
add_executable(ex_a4a5 example/ex_a4a5.c)
target_link_libraries(ex_a4a5 a4a5 ${A4A5_LIBS})