I cannot think of any particular general purpose solution for this, although most certainly there are people who have solved this multiple times, in various ways.
One could well use the available/built-in pathfinding abilities, this should work fine but is probably not the primary issue.
The challenge is to define an optimal node graph. This depends on how greedily the task should be solved, and also on the particular features of the environment. Apparently, a building has for example corridors, and apparently it is sometimes fastest to pass a corridor diagonally, ie. enter it by it's left wall and leaving it by it's right wall? Maybe there are rooms that need to be crossed diagonally or along some of it's walls? Staircases?
I would probably (as i like to control things myself) solve this by first creating a node graph that holds all possible nodes (points), ie. every corner and every door (even left and right edge of it separately?) is a node, or holds a node very nearby. Then I'd perform a "all nodes against all nodes" test and create a link between two nodes whenever they can see each other directly (could even use the 3D engines hit testing for that, if there is a building model available); at the same time calculate the distances as graph weights. This would create the "full set" node graph. Finally, I'd execute "go from each room to each other room" pathfinding tasks and mark any node/link that was ever used with 1. To naturally then remove from the graph all such nodes/links that were never used. This would create the minimum node graph that covers for all possible movement, suitable for runtime use, to be embedded with the application. And also be a test for the overall functionality - perhaps an extra node bust be inserted somewhere because of some unexpected reason?