#!/bin/sh -e

# Success
mkdir -p build1/m4
cd build1/m4

cmake -DUSE_LIB=OFF ../../Module4
make
./Module4

cd -


# Fail
mkdir -p build2/m3
mkdir -p build2/m4

cd build2/m3
cmake -DCMAKE_INSTALL_PREFIX=$(pwd)/../m3.install ../../Module3
make install
cd -

cd build2/m4
cmake -DMODULE3_INSTALL_PREFIX=$(pwd)/../m3.install ../../Module4
make

./Module4
