You could of course set CMAKE_CXX_FLAGS to
 STRING=-fPIC -D__STDC_CONSTANT_MACROS
(i.e., just a blank-separated list)

As to the error with ../../../../lib/libvil_io.a :
Did you try to do a "clean" build, i.e., starting over with a fresh (empty) build directory tree, except for CMakeCache.txt ?
Or maybe just remove the mentioned library and restart the build.

-- Peter.