A small tweak to support cmake 2.6 (cmake 2.6's string(SUBSTRING ...) does not support -1 lengths).