#!/bin/sh
cd ${0%/*} || exit 1                            # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/cmakeFunctions  # The CMake functions

# -----------------------------------------------------------------------------

echo "======================================================================"
echo "${PWD##*/} : $PWD"
echo

unset depend
if [ -d "$VTK_DIR" ]
then
    depend="VTK_DIR=$VTK_DIR"
elif [ -d "$ParaView_DIR" ]
then
    depend="ParaView_DIR=$ParaView_DIR"
fi

if [ -n "$depend" ]
then
    if [ "$targetType" != objects ]
    then
        if command -v cmake > /dev/null 2>&1
        then
            cmakeVersioned "$depend" $PWD || {
                echo
                echo "    WARNING: incomplete build of VTK-based post-processing"
                echo
            }
        else
            echo "WARNING: skipped - needs cmake"
        fi
    fi
else
    echo "WARNING: skipped - needs a VTK or a ParaView installation"
    echo "    - For ParaView  : export the 'ParaView_DIR' variable"
    echo "    - For VTK       : export the 'VTK_DIR'      variable"
fi

echo "======================================================================"

# -----------------------------------------------------------------------------
