Added some ifdefs and a definition for cmake so that BEM code is not compiled if BEM is not enabled.  Fixes #25.
Merge branch 'master' into issue-22