aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2021-02-27 00:37:26 +0100
committerRobert Tari <robert@tari.in>2021-06-09 13:55:39 +0200
commit367188dbba4f98a597aca9ced7832762fc88b062 (patch)
tree56e6cfcecc97f8c1a50c8ed5ff25f4bbec5b2f3e /cmake
parent2d8c300a3ce04ea7e372e38c81a65f06f0890a50 (diff)
downloadlibayatana-appindicator-367188dbba4f98a597aca9ced7832762fc88b062.tar.gz
libayatana-appindicator-367188dbba4f98a597aca9ced7832762fc88b062.tar.bz2
libayatana-appindicator-367188dbba4f98a597aca9ced7832762fc88b062.zip
Add CMakeLists.txt files + cmake/ helpers
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindGObjectIntrospection.cmake61
-rw-r--r--cmake/FindVala.cmake57
-rw-r--r--cmake/UseGObjectIntrospection.cmake100
-rw-r--r--cmake/UseVala.cmake241
4 files changed, 459 insertions, 0 deletions
diff --git a/cmake/FindGObjectIntrospection.cmake b/cmake/FindGObjectIntrospection.cmake
new file mode 100644
index 0000000..2073c3c
--- /dev/null
+++ b/cmake/FindGObjectIntrospection.cmake
@@ -0,0 +1,61 @@
+# - try to find gobject-introspection
+#
+# Once done this will define
+#
+# INTROSPECTION_FOUND - system has gobject-introspection
+# INTROSPECTION_SCANNER - the gobject-introspection scanner, g-ir-scanner
+# INTROSPECTION_COMPILER - the gobject-introspection compiler, g-ir-compiler
+# INTROSPECTION_GENERATE - the gobject-introspection generate, g-ir-generate
+# INTROSPECTION_GIRDIR
+# INTROSPECTION_TYPELIBDIR
+# INTROSPECTION_CFLAGS
+# INTROSPECTION_LIBS
+#
+# Copyright (C) 2010, Pino Toscano, <pino@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+macro(_GIR_GET_PKGCONFIG_VAR _outvar _varname)
+ execute_process(
+ COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=${_varname} gobject-introspection-1.0
+ OUTPUT_VARIABLE _result
+ RESULT_VARIABLE _null
+ )
+
+ if (_null)
+ else()
+ string(REGEX REPLACE "[\r\n]" " " _result "${_result}")
+ string(REGEX REPLACE " +$" "" _result "${_result}")
+ separate_arguments(_result)
+ set(${_outvar} ${_result} CACHE INTERNAL "")
+ endif()
+endmacro(_GIR_GET_PKGCONFIG_VAR)
+
+find_package(PkgConfig)
+if(PKG_CONFIG_FOUND)
+ if(PACKAGE_FIND_VERSION_COUNT GREATER 0)
+ set(_gir_version_cmp ">=${PACKAGE_FIND_VERSION}")
+ endif()
+ pkg_check_modules(_pc_gir gobject-introspection-1.0${_gir_version_cmp})
+ if(_pc_gir_FOUND)
+ set(INTROSPECTION_FOUND TRUE)
+ _gir_get_pkgconfig_var(INTROSPECTION_SCANNER "g_ir_scanner")
+ _gir_get_pkgconfig_var(INTROSPECTION_COMPILER "g_ir_compiler")
+ _gir_get_pkgconfig_var(INTROSPECTION_GENERATE "g_ir_generate")
+ _gir_get_pkgconfig_var(INTROSPECTION_GIRDIR "girdir")
+ _gir_get_pkgconfig_var(INTROSPECTION_TYPELIBDIR "typelibdir")
+ set(INTROSPECTION_CFLAGS "${_pc_gir_CFLAGS}")
+ set(INTROSPECTION_LIBS "${_pc_gir_LIBS}")
+ endif()
+endif()
+
+mark_as_advanced(
+ INTROSPECTION_SCANNER
+ INTROSPECTION_COMPILER
+ INTROSPECTION_GENERATE
+ INTROSPECTION_GIRDIR
+ INTROSPECTION_TYPELIBDIR
+ INTROSPECTION_CFLAGS
+ INTROSPECTION_LIBS
+)
diff --git a/cmake/FindVala.cmake b/cmake/FindVala.cmake
new file mode 100644
index 0000000..a638735
--- /dev/null
+++ b/cmake/FindVala.cmake
@@ -0,0 +1,57 @@
+# - Find Vala
+# This module looks for valac.
+# This module defines the following values:
+# VALA_FOUND
+# VALA_COMPILER
+# VALA_VERSION
+# VAPI_GEN
+# VAPI_GEN_VERSION
+
+#=============================================================================
+# Copyright Přemysl Janouch 2011
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+# OF SUCH DAMAGE.
+#=============================================================================
+
+find_program (VALA_COMPILER "valac")
+
+if (VALA_COMPILER)
+ execute_process (COMMAND ${VALA_COMPILER} --version
+ OUTPUT_VARIABLE VALA_VERSION)
+ string (REGEX MATCH "[.0-9]+" VALA_VERSION "${VALA_VERSION}")
+endif (VALA_COMPILER)
+
+find_program (VAPI_GEN "vapigen")
+
+if (VAPI_GEN)
+ execute_process (COMMAND ${VAPI_GEN} --version
+ OUTPUT_VARIABLE VAPI_GEN_VERSION)
+ string (REGEX MATCH "[.0-9]+" VAPI_GEN_VERSION "${VAPI_GEN_VERSION}")
+endif (VAPI_GEN)
+
+include (FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS (Vala
+ REQUIRED_VARS VALA_COMPILER
+ VERSION_VAR VALA_VERSION)
+
+mark_as_advanced (VALA_COMPILER VALA_VERSION VAPI_GEN)
+
diff --git a/cmake/UseGObjectIntrospection.cmake b/cmake/UseGObjectIntrospection.cmake
new file mode 100644
index 0000000..d6d1810
--- /dev/null
+++ b/cmake/UseGObjectIntrospection.cmake
@@ -0,0 +1,100 @@
+# Copyright (C) 2010, Pino Toscano, <pino@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+include(ListOperations)
+
+macro(_gir_list_prefix _outvar _listvar _prefix)
+ set(${_outvar})
+ foreach(_item IN LISTS ${_listvar})
+ list(APPEND ${_outvar} ${_prefix}${_item})
+ endforeach()
+endmacro(_gir_list_prefix)
+
+macro(gir_add_introspections introspections_girs)
+
+ foreach(gir IN LISTS ${introspections_girs})
+
+ set(_gir_name "${gir}")
+
+ ## Transform the gir filename to something which can reference through a variable
+ ## without automake/make complaining, eg Gtk-2.0.gir -> Gtk_2_0_gir
+ string(REPLACE "-" "_" _gir_name "${_gir_name}")
+ string(REPLACE "." "_" _gir_name "${_gir_name}")
+
+ # Namespace and Version is either fetched from the gir filename
+ # or the _NAMESPACE/_VERSION variable combo
+ set(_gir_namespace "${${_gir_name}_NAMESPACE}")
+ if (_gir_namespace STREQUAL "")
+ string(REGEX REPLACE "([^-]+)-.*" "\\1" _gir_namespace "${gir}")
+ endif ()
+ set(_gir_version "${${_gir_name}_VERSION}")
+ if (_gir_version STREQUAL "")
+ string(REGEX REPLACE ".*-([^-]+).gir" "\\1" _gir_version "${gir}")
+ endif ()
+
+ # _PROGRAM is an optional variable which needs it's own --program argument
+ set(_gir_program "${${_gir_name}_PROGRAM}")
+ if (NOT _gir_program STREQUAL "")
+ set(_gir_program "--program=${_gir_program}")
+ endif ()
+
+ # Variables which provides a list of things
+ _gir_list_prefix(_gir_libraries ${_gir_name}_LIBS "--library=")
+ _gir_list_prefix(_gir_packages ${_gir_name}_PACKAGES "--pkg=")
+ _gir_list_prefix(_gir_includes ${_gir_name}_INCLUDES "--include=")
+ _gir_list_prefix(_gir_export_packages ${_gir_name}_EXPORT_PACKAGES "--pkg-export=")
+
+ # Reuse the LIBTOOL variable from by automake if it's set
+ set(_gir_libtool "--no-libtool")
+
+ add_custom_command(
+ COMMAND ${INTROSPECTION_SCANNER}
+ ${INTROSPECTION_SCANNER_ARGS}
+ --namespace=${_gir_namespace}
+ --nsversion=${_gir_version}
+ ${_gir_libtool}
+ ${_gir_program}
+ ${_gir_libraries}
+ ${_gir_packages}
+ ${_gir_includes}
+ ${_gir_export_packages}
+ ${${_gir_name}_SCANNERFLAGS}
+ ${${_gir_name}_CFLAGS}
+ ${${_gir_name}_FILES}
+ --output ${CMAKE_CURRENT_BINARY_DIR}/${gir}
+ DEPENDS ${${_gir_name}_FILES}
+ ${${_gir_name}_LIBS}
+ OUTPUT ${gir}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ VERBATIM
+ )
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${gir} DESTINATION share/gir-1.0)
+
+ string(REPLACE ".gir" ".typelib" _typelib "${gir}")
+ add_custom_command(
+ COMMAND ${INTROSPECTION_COMPILER}
+ ${INTROSPECTION_COMPILER_ARGS}
+ --includedir=.
+ ${CMAKE_CURRENT_BINARY_DIR}/${gir}
+ -o ${CMAKE_CURRENT_BINARY_DIR}/${_typelib}
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${gir}
+ OUTPUT ${_typelib}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_typelib} DESTINATION ${CMAKE_INSTALL_LIBDIR}/girepository-1.0)
+
+ add_custom_target(gir-${gir} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${gir})
+ add_custom_target(gir-typelibs-${_typelib} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_typelib})
+ endforeach()
+
+endmacro(gir_add_introspections)
+
+macro(gir_get_cflags _output)
+ get_directory_property(_tmp_includes INCLUDE_DIRECTORIES)
+ list_prefix(_includes _tmp_includes "-I")
+ get_directory_property(_tmp_compile_definitions COMPILE_DEFINITIONS)
+ list_prefix(_compile_definitions _tmp_compile_definitions "-D")
+ set(${_output} ${_includes} ${_compile_definitions})
+endmacro(gir_get_cflags)
diff --git a/cmake/UseVala.cmake b/cmake/UseVala.cmake
new file mode 100644
index 0000000..f0202e2
--- /dev/null
+++ b/cmake/UseVala.cmake
@@ -0,0 +1,241 @@
+# - Precompilation of Vala/Genie source files into C sources
+# Makes use of the parallel build ability introduced in Vala 0.11. Derived
+# from a similar module by Jakob Westhoff and the original GNU Make rules.
+# Might be a bit oversimplified.
+#
+# This module defines three functions. The first one:
+#
+# vala_init (id
+# [DIRECTORY dir] - Output directory (binary dir by default)
+# [PACKAGES package...] - Package dependencies
+# [OPTIONS option...] - Extra valac options
+# [CUSTOM_VAPIS file...]) - Custom vapi files to include in the build
+# [DEPENDS targets...]) - Extra dependencies for code generation
+#
+# initializes a single precompilation unit using the given arguments.
+# You can put files into it via the following function:
+#
+# vala_add (id source.vala
+# [DEPENDS source...]) - Vala/Genie source or .vapi dependencies
+#
+# Finally retrieve paths for generated C files by calling:
+#
+# vala_finish (id
+# [SOURCES sources_var] - Input Vala/Genie sources
+# [OUTPUTS outputs_var] - Output C sources
+# [GENERATE_HEADER id.h - Generate id.h and id_internal.h
+# [GENERATE_VAPI id.vapi] - Generate a vapi file
+# [GENERATE_SYMBOLS id.def]]) - Generate a list of public symbols
+#
+
+#=============================================================================
+# Copyright Přemysl Janouch 2011
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+# OF SUCH DAMAGE.
+#=============================================================================
+
+find_package (Vala 0.20 REQUIRED)
+include (CMakeParseArguments)
+
+function (vala_init id)
+ set (_multi_value PACKAGES OPTIONS CUSTOM_VAPIS DEPENDS)
+ cmake_parse_arguments (arg "" "DIRECTORY" "${_multi_value}" ${ARGN})
+
+ if (arg_DIRECTORY)
+ set (directory ${arg_DIRECTORY})
+ if (NOT IS_DIRECTORY ${directory})
+ file (MAKE_DIRECTORY ${directory})
+ endif (NOT IS_DIRECTORY ${directory})
+ else (arg_DIRECTORY)
+ set (directory ${CMAKE_CURRENT_BINARY_DIR})
+ endif (arg_DIRECTORY)
+
+ set (pkg_opts)
+ foreach (pkg ${arg_PACKAGES})
+ list (APPEND pkg_opts "--pkg=${pkg}")
+ endforeach (pkg)
+
+ set (VALA_${id}_DIR "${directory}" PARENT_SCOPE)
+ set (VALA_${id}_ARGS ${pkg_opts} ${arg_OPTIONS}
+ ${arg_CUSTOM_VAPIS} PARENT_SCOPE)
+ set (VALA_${id}_DEPENDS ${arg_DEPENDS}
+ PARENT_SCOPE)
+
+ set (VALA_${id}_SOURCES "" PARENT_SCOPE)
+ set (VALA_${id}_OUTPUTS "" PARENT_SCOPE)
+ set (VALA_${id}_FAST_VAPI_FILES "" PARENT_SCOPE)
+ set (VALA_${id}_FAST_VAPI_ARGS "" PARENT_SCOPE)
+endfunction (vala_init)
+
+function (vala_add id file)
+ cmake_parse_arguments (arg "" "" "DEPENDS" ${ARGN})
+
+ if (NOT IS_ABSOLUTE "${file}")
+ set (file "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
+ endif (NOT IS_ABSOLUTE "${file}")
+
+ get_filename_component (output_name "${file}" NAME)
+ get_filename_component (output_base "${file}" NAME_WE)
+ set (output_base "${VALA_${id}_DIR}/${output_base}")
+
+ # XXX: It would be best to have it working without touching the vapi
+ # but it appears this cannot be done in CMake.
+ add_custom_command (OUTPUT "${output_base}.vapi"
+ COMMAND ${VALA_COMPILER} "${file}" "--fast-vapi=${output_base}.vapi"
+ COMMAND ${CMAKE_COMMAND} -E touch "${output_base}.vapi"
+ DEPENDS "${file}"
+ COMMENT "Generating a fast vapi for ${output_name}" VERBATIM)
+
+ set (vapi_opts)
+ set (vapi_depends)
+ foreach (vapi ${arg_DEPENDS})
+ if (NOT IS_ABSOLUTE "${vapi}")
+ set (vapi "${VALA_${id}_DIR}/${vapi}.vapi")
+ endif (NOT IS_ABSOLUTE "${vapi}")
+
+ list (APPEND vapi_opts "--use-fast-vapi=${vapi}")
+ list (APPEND vapi_depends "${vapi}")
+ endforeach (vapi)
+
+ add_custom_command (OUTPUT "${output_base}.c"
+ COMMAND ${VALA_COMPILER} "${file}" -C ${vapi_opts} ${VALA_${id}_ARGS}
+ COMMAND ${CMAKE_COMMAND} -E touch "${output_base}.c"
+ DEPENDS "${file}" ${vapi_depends} ${VALA_${id}_DEPENDS}
+ WORKING_DIRECTORY "${VALA_${id}_DIR}"
+ COMMENT "Precompiling ${output_name}" VERBATIM)
+
+ set (VALA_${id}_SOURCES ${VALA_${id}_SOURCES}
+ "${file}" PARENT_SCOPE)
+ set (VALA_${id}_OUTPUTS ${VALA_${id}_OUTPUTS}
+ "${output_base}.c" PARENT_SCOPE)
+ set (VALA_${id}_FAST_VAPI_FILES ${VALA_${id}_FAST_VAPI_FILES}
+ "${output_base}.vapi" PARENT_SCOPE)
+ set (VALA_${id}_FAST_VAPI_ARGS ${VALA_${id}_FAST_VAPI_ARGS}
+ "--use-fast-vapi=${output_base}.vapi" PARENT_SCOPE)
+endfunction (vala_add)
+
+function (vala_finish id)
+ set (_one_value SOURCES OUTPUTS
+ GENERATE_VAPI GENERATE_HEADER GENERATE_SYMBOLS)
+ cmake_parse_arguments (arg "" "${_one_value}" "" ${ARGN})
+
+ if (arg_SOURCES)
+ set (${arg_SOURCES} ${VALA_${id}_SOURCES} PARENT_SCOPE)
+ endif (arg_SOURCES)
+
+ if (arg_OUTPUTS)
+ set (${arg_OUTPUTS} ${VALA_${id}_OUTPUTS} PARENT_SCOPE)
+ endif (arg_OUTPUTS)
+
+ set (outputs)
+ set (export_args)
+
+ if (arg_GENERATE_VAPI)
+ if (NOT IS_ABSOLUTE "${arg_GENERATE_VAPI}")
+ set (arg_GENERATE_VAPI
+ "${VALA_${id}_DIR}/${arg_GENERATE_VAPI}")
+ endif (NOT IS_ABSOLUTE "${arg_GENERATE_VAPI}")
+
+ list (APPEND outputs "${arg_GENERATE_VAPI}")
+ list (APPEND export_args "--internal-vapi=${arg_GENERATE_VAPI}")
+
+ if (NOT arg_GENERATE_HEADER)
+ message (FATAL_ERROR "Header generation required for vapi")
+ endif (NOT arg_GENERATE_HEADER)
+ endif (arg_GENERATE_VAPI)
+
+ if (arg_GENERATE_SYMBOLS)
+ if (NOT IS_ABSOLUTE "${arg_GENERATE_SYMBOLS}")
+ set (arg_GENERATE_SYMBOLS
+ "${VALA_${id}_DIR}/${arg_GENERATE_SYMBOLS}")
+ endif (NOT IS_ABSOLUTE "${arg_GENERATE_SYMBOLS}")
+
+ list (APPEND outputs "${arg_GENERATE_SYMBOLS}")
+ list (APPEND export_args "--symbols=${arg_GENERATE_SYMBOLS}")
+
+ if (NOT arg_GENERATE_HEADER)
+ message (FATAL_ERROR "Header generation required for symbols")
+ endif (NOT arg_GENERATE_HEADER)
+ endif (arg_GENERATE_SYMBOLS)
+
+ if (arg_GENERATE_HEADER)
+ if (NOT IS_ABSOLUTE "${arg_GENERATE_HEADER}")
+ set (arg_GENERATE_HEADER
+ "${VALA_${id}_DIR}/${arg_GENERATE_HEADER}")
+ endif (NOT IS_ABSOLUTE "${arg_GENERATE_HEADER}")
+
+ get_filename_component (header_path "${arg_GENERATE_HEADER}" PATH)
+ get_filename_component (header_name "${arg_GENERATE_HEADER}" NAME_WE)
+ set (header_base "${header_path}/${header_name}")
+ get_filename_component (header_ext "${arg_GENERATE_HEADER}" EXT)
+
+ list (APPEND outputs
+ "${header_base}${header_ext}"
+ "${header_base}_internal${header_ext}")
+ list (APPEND export_args
+ "--header=${header_base}${header_ext}"
+ "--internal-header=${header_base}_internal${header_ext}")
+ endif (arg_GENERATE_HEADER)
+
+ if (outputs)
+ add_custom_command (OUTPUT ${outputs}
+ COMMAND ${VALA_COMPILER} -C ${VALA_${id}_ARGS}
+ ${export_args} ${VALA_${id}_FAST_VAPI_ARGS}
+ DEPENDS ${VALA_${id}_FAST_VAPI_FILES}
+ COMMENT "Generating vapi/headers/symbols" VERBATIM)
+ endif (outputs)
+endfunction (vala_finish id)
+
+
+function (vapi_gen id)
+ set (_one_value LIBRARY INPUT)
+ set (_multi_value PACKAGES)
+ cmake_parse_arguments (arg "" "${_one_value}" "${_multi_value}" ${ARGN})
+
+ set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${id}.vapi")
+ if (arg_LIBRARY)
+ set (OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${arg_LIBRARY}.vapi")
+ endif (arg_LIBRARY)
+
+ set("${id}_OUTPUT" ${OUTPUT} PARENT_SCOPE)
+
+ set(PACKAGE_LIST)
+ foreach(PACKAGE ${arg_PACKAGES})
+ list(APPEND PACKAGE_LIST "--pkg" ${PACKAGE})
+ endforeach()
+
+ add_custom_command(
+ OUTPUT
+ ${OUTPUT}
+ COMMAND
+ ${VAPI_GEN}
+ ${PACKAGE_LIST}
+ --library=${arg_LIBRARY}
+ ${arg_INPUT}
+ DEPENDS
+ ${arg_INPUT}
+ VERBATIM
+ )
+
+ add_custom_target(${id} ALL DEPENDS ${OUTPUT})
+endfunction (vapi_gen id)
+