Fix clone session not working for BMv2 built in p4vm

Change-Id: I9e1e2516aa886303b406a9d5ab286c5f22e733d3
diff --git a/tools/dev/p4vm/install-p4-tools.sh b/tools/dev/p4vm/install-p4-tools.sh
index 19508b5..204ffbd 100755
--- a/tools/dev/p4vm/install-p4-tools.sh
+++ b/tools/dev/p4vm/install-p4-tools.sh
@@ -232,6 +232,9 @@
     ./autogen.sh
 
     confOpts="--with-pi --disable-elogger --without-nanomsg --without-targets"
+    # We are building --without-targets but we know for sure we need those
+    # parts of the BMv2 PI library for simple_switch.
+    cppFlags="-I${PWD}/targets/simple_switch -DWITH_SIMPLE_SWITCH"
     if [[ "${FAST_BUILD}" = true ]] ; then
         confOpts="${confOpts} --disable-dependency-tracking"
     fi
@@ -239,9 +242,10 @@
         confOpts="${confOpts} --disable-logging-macros"
     fi
     if [[ "${USE_STRATUM}" = true ]] ; then
-        confOpts="CPPFLAGS=\"-isystem${BMV2_INSTALL}/include\" --prefix=${BMV2_INSTALL} --without-thrift ${confOpts}"
+        confOpts="--prefix=${BMV2_INSTALL} --without-thrift ${confOpts}"
+        cppFlags="${cppFlags} -isystem${BMV2_INSTALL}/include"
     fi
-    confCmd="./configure ${confOpts}"
+    confCmd="./configure CPPFLAGS=\"${cppFlags}\" ${confOpts}"
     eval ${confCmd}
 
     make -j${NUM_CORES}