The proper choice of cmake flags certainly will help solving your problem. Reading question and answer of this SO post may be helpful.
I am not fully convinced if you followed the referenced instructions exactly, because in the excerpt of the CMakeCache (see here, point 5), BUILD_SHARED_LIBS
was disabled. However, your problem indicates that your binary was linked dynamically. Here I'm missing further details about your setup.
Let me maybe share the cmake command that I used to build vtk (with python wrapper and shared libraries). This worked for vtk 7.x.
mkdir build
cd build
INSTALL_DIR="/opt/dev/versions/vtk/vtk-7.1.0-shared"
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DVTK_WRAP_PYTHON=ON \
-DBUILD_EXAMPLES=OFF \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
-DCMAKE_MACOSX_RPATH=ON \
-DCMAKE_INSTALL_RPATH="$INSTALL_DIR/lib" \
-DPYTHON_INCLUDE_DIR="/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/" \
-DPYTHON_LIBRARY="/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib"
make -j8
make install
Note that I had to set the python related flags to ensure that the correct python environment is used. (Often, there are multiple python environments available on a Mac: The python distributed by MacOS itself, a user python that was installed via homebrew or macports, or the framework that was acquired via www.python.org. For me the third option applied.)