intf_libs = # Interface dependencies.
impl_libs = # Implementation dependencies.

import libbuild2 = build2%lib{build2}

import impl_libs += $libbuild2 # Implied interface dependency.
import impl_libs += build2%lib{build2-cxx}

lib{build2-qt}: {hxx ixx txx cxx}{**} $impl_libs $intf_libs

hxx{export}@./: cxx.importable = false

# Build options.
#
cxx.poptions =+ "-I$out_root" "-I$src_root"

{hbmia obja}{*}: cxx.poptions += -DLIBBUILD2_QT_STATIC_BUILD
{hbmis objs}{*}: cxx.poptions += -DLIBBUILD2_QT_SHARED_BUILD

# Export options.
#
lib{build2-qt}:
{
  cxx.export.poptions = "-I$out_root" "-I$src_root"
  cxx.export.libs = $intf_libs
}

liba{build2-qt}: cxx.export.poptions += -DLIBBUILD2_QT_STATIC
libs{build2-qt}: cxx.export.poptions += -DLIBBUILD2_QT_SHARED

# For pre-releases use the complete version to make sure they cannot be used
# in place of another pre-release or the final version. See the version module
# for details on the version.* variable values.
#
if $version.pre_release
  lib{build2-qt}: bin.lib.version = "-$version.project_id"
else
  lib{build2-qt}: bin.lib.version = "-$version.major.$version.minor"

# Embed the build system core version as our load suffix.
#
# Get the version as exported by the lib{build2} target falling back to the
# running build system version if unable to (installed lib{build2}).
#
iv = ($project($libbuild2) == [null]     \
      ? $($libbuild2: interface_version) \
      : [null])

ifn $iv
  iv = $build.version.interface

libs{build2-qt}: bin.lib.load_suffix = "-$iv"

# Install into the libbuild2/qt/ subdirectory of, say, /usr/include/
# recreating subdirectories.
#
{hxx ixx txx}{*}:
{
  install         = include/libbuild2/qt/
  install.subdirs = true
}
