Use std::advance to advance iterators instead of ++ prefix operator
Updated CMake files for release and debug builds