How do I move my folders created by CMake?

2019-09-09 14:14发布

问题:

CMake uses absolute paths when it generates project files for Visual C++.

Sometimes, I need to move my project folder to some other drive.

But when I move the folder (and try to replace all the paths in the project files), this triggers a long, arduous recompilation process that wastes a lot of my time for absolutely no reason.

How do I move CMake project folder(s) to an arbitrary location without triggering a recompilation?

回答1:

From the documentation of CMAKE_USE_RELATIVE_PATHS var:

In general, it is not possible to move CMake generated makefiles to a different location regardless of the value of this variable.