#!/bin/sh
# autopkgtest check: Build and run a program against ign-transport, to verify that the
# headers and pkg-config file are installed correctly
# (C) 2021 Jose Luis Rivero
# Author: Jose Luis Rivero <jrivero@osrfoundation.org>

set -e

WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR

# CMake
cat <<EOF > CMakeLists.txt
cmake_minimum_required(VERSION 3.10)

project(ign_test VERSION 1.0.0)

find_package(OGRE-Next REQUIRED)

foreach(PLUGIN Plugin_ParticleFX RenderSystem_GL3Plus)
  message(STATUS " Checking: \${PLUGIN}")
  if(\${OGRE-Next_\${PLUGIN}_FOUND})
    message(STATUS " -- ok")
  else()
    message(FATAL_ERROR "-- not found")
  endif()
endforeach()
EOF

cmake .
echo "configure cmake with component: OK"
