project(error-mem-viewer)
cmake_minimum_required(VERSION 2.8)
find_package(PkgConfig REQUIRED)

pkg_search_module(GLIB REQUIRED glib-2.0)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
pkg_check_modules(GTK_MOD REQUIRED gmodule-2.0)

aux_source_directory("src" SRCES)
include_directories("include" ${GLIB_INCLUDE_DIRS} ${GTK3_INCLUDE_DIRS} ${GTK_MOD_INCLUDE_DIRS})

add_subdirectory(resources)

set(SOURCE_GENERATED
  ${CMAKE_CURRENT_BINARY_DIR}/resources/resources.c
)
SET_SOURCE_FILES_PROPERTIES(${SOURCE_GENERATED} PROPERTIES GENERATED 1)

add_compile_options(-Wall -Wextra -Wold-style-declaration -Wuninitialized -Wmaybe-uninitialized -Wunused-parameter)

link_directories(${GLIB_LINK_DIRS} ${GTK3_LINK_DIRS} ${GTK_MOD_LINK_DIRS})
add_definitions(${GLIB2_CFLAGS_OTHER} ${GTK_MOD_CFLAGS_OTHER})

add_executable(${PROJECT_NAME} ${SRCES} ${SOURCE_GENERATED})
target_link_libraries(${PROJECT_NAME} ${GLIB_LDFLAGS} ${GTK3_LDFLAGS} ${GTK_MOD_LDFLAGS})
add_dependencies(${PROJECT_NAME} glib-resources)
