find_package (PkgConfig REQUIRED)
pkg_check_modules (GLIB2 REQUIRED glib-2.0)
pkg_check_modules (GOBJECT2 REQUIRED gobject-2.0)

include_directories (${GLIB2_INCLUDE_DIRS})
link_directories (${GLIB2_LIBRARY_DIRS})
include_directories (${GOBJECT2_INCLUDE_DIRS})
link_directories (${GOBJECT2_LIBRARY_DIRS})
if (CMAKE_COMPILER_IS_GNUCC)
  add_definitions (${GLIB2_CFLAGS_OTHER})
  add_definitions (${GOBJECT2_CFLAGS_OTHER})
endif ()

FILE (GLOB GModuleSources RELATIVE ${PROJECT_SOURCE_DIR}/test *.vala)
vala_precompile (VALA_C ${GModuleSources}
                 PACKAGES gtk+-3.0
                 OPTIONS ${VALAC_OPTIONS}
                 CUSTOM_VAPIS
                 GENERATE_VAPI gmodule-test
                 GENERATE_HEADER gmodule-test
                )

# add the executable
add_executable (gmodule-test ${VALA_C})
target_link_libraries (gmodule-test ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
