VNL is a C++ library to do math with convenient matrix, vector templates and overloaded operators. The next natural thing for me to explore was to write MEX files for MATLAB using VNL. I had tough time forcing CMake to spit out mex files.
Here are the commands that worked for me in x86_64 machine. Let $PREFIX be that path where you installed VXL, ITK, etc.. (/usr/local).
g++ -fPIC -c vnl_code.cpp -I $PREFIX/include/vxl/core -I $PREFIX/include/vcl
# generate a static lib of all your vnl code
ar cqs libvnl_code.a vnl_code.o
mex -I$PREFIX/include/vxl/core -I$PREFIX/include/vcl -L$PREFIX/lib/ libvnl_code.a mex_wrapper.cpp
Make sure that your C++ code does not have any extern "C" statements. Also, if you are doing this on x86_64, VXL has to be built with -fPIC compiler flag.