Use cmake to build zavai
[gregoa/zavai.git] / src / CMakeLists.txt
1 project(zavai)
2
3 include(FindPkgConfig)
4
5 set(zavai_version 0.1)
6 set(VFLAGS -C --pkg gee-1.0 --pkg dbus-glib-1 --pkg gtk+-2.0 --pkg posix --pkg libwnck-1.0 --vapidir=${zavai_SOURCE_DIR} --pkg linux-input --pkg dbus-extra --pkg devkit-power-gobject --pkg omhacks)
7
8 pkg_check_modules(GTK REQUIRED gtk+-2.0)
9 pkg_check_modules(GEE REQUIRED gee-1.0)
10 pkg_check_modules(DBUS REQUIRED dbus-glib-1>=0.80)
11 pkg_check_modules(WNCK REQUIRED libwnck-1.0>=2.26.0)
12 pkg_check_modules(DEVKITPOWER REQUIRED devkit-power-gobject>=010)
13 pkg_check_modules(OMHACKS REQUIRED libomhacks)
14
15 find_program(VALAC valac)
16
17 file(GLOB zavala *.vala)
18 string(REGEX REPLACE "^.+/(.+)\\.vala$" "${zavai_BINARY_DIR}/\\1.c" zasrc ${zavala})
19
20 add_custom_command(
21     DEPENDS ${zavala}
22     OUTPUT ${zasrc}
23     COMMAND ${VALAC} ${VFLAGS} --pkg=gtkfisheyelist --vapidir=${gtkfisheyelist_BINARY_DIR} ${zavala}
24 )
25
26 include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
27 # -Werror 
28 add_definitions(-Wall ${GTK_CFLAGS} ${GEE_CFLAGS} ${DBUS_CFLAGS} ${WNCK_CFLAGS} ${DEVKITPOWER_CFLAGS} ${OMHACKS_CFLAGS} -I${gtkfisheyelist_BINARY_DIR})
29 link_libraries(wibble ${GTK_LDFLAGS} ${GEE_LDFLAGS} ${DBUS_LDFLAGS} ${WNCK_LDFLAGS} ${DEVKITPOWER_LDFLAGS} ${OMHACKS_LDFLAGS} gtkfisheyelist-static)
30
31 set_source_files_properties(${zasrc} PROPERTIES GENERATED 1)
32 set_source_files_properties(${zahdr} PROPERTIES GENERATED 1)
33
34 add_executable(zavai ${zasrc})
35
36 install(TARGETS zavai RUNTIME DESTINATION bin)