Started cmake and put gtkfisheyelist as separate module
[gregoa/zavai.git] / gtkfisheyelist / CMakeLists.txt
1 project(gtkfisheyelist)
2
3 include(FindPkgConfig)
4
5 set(gtkfisheyelist_version 0.1)
6 set(VFLAGS -C --pkg gtk+-2.0)
7
8 pkg_check_modules(GTK REQUIRED gtk+-2.0)
9
10 find_program(VALAC valac)
11
12 file(GLOB fevala *.vala)
13 string(REGEX REPLACE "^.+/(.+)\\.vala$" "${gtkfisheyelist_BINARY_DIR}/\\1.c" fesrc ${fevala})
14 string(REGEX REPLACE "^.+/(.+)\\.vala$" "${gtkfisheyelist_BINARY_DIR}/\\1.h" fehdr ${fevala})
15
16 add_custom_command(
17     DEPENDS ${fevala}
18     OUTPUT ${fesrc} ${fehdr}
19     COMMAND ${VALAC} ${VFLAGS} ${fevala}
20 )
21
22 add_definitions(-Wall -Werror ${GTK_CFLAGS})
23 link_libraries(${GTK_LDFLAGS})
24
25 set_source_files_properties(${fesrc} PROPERTIES GENERATED 1)
26 set_source_files_properties(${fehdr} PROPERTIES GENERATED 1)
27
28 add_library(gtkfisheyelist SHARED ${fesrc})
29 add_library(gtkfisheyelist-static STATIC ${fesrc})
30 set_target_properties(gtkfisheyelist PROPERTIES VERSION ${gtkfisheyelist_version} SOVERSION 0 CLEAN_DIRECT_OUTPUT 1)
31 set_target_properties(gtkfisheyelist-static PROPERTIES VERSION ${gtkfisheyelist_version} SOVERSION 0 OUTPUT_NAME "gtkfisheyelist" CLEAN_DIRECT_OUTPUT 1)
32
33 set(prefix "${CMAKE_INSTALL_PREFIX}")
34 set(exec_prefix "${prefix}/bin")
35 set(libdir "${prefix}/lib")
36 set(includedir "${prefix}/include")
37 configure_file(${gtkfisheyelist_SOURCE_DIR}/libgtkfisheyelist.pc.in ${gtkfisheyelist_BINARY_DIR}/libgtkfisheyelist.pc @ONLY)
38
39 install(TARGETS gtkfisheyelist gtkfisheyelist-static
40   LIBRARY DESTINATION lib
41   ARCHIVE DESTINATION lib)
42
43 install(FILES ${fehdr} DESTINATION include/gtkfisheyelist)
44
45 install(FILES ${gtkfisheyelist_BINARY_DIR}/libgtkfisheyelist.pc DESTINATION lib/pkgconfig)
46