add cmake function to read index