0

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?

user541686
  • 205,094
  • 128
  • 528
  • 886

1 Answers1

3

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.

arrowd
  • 33,231
  • 8
  • 79
  • 110
  • Actually this variable works great for Visual Studio generators (at least VS 2008 and 2010) – szx Sep 01 '12 at 23:42
  • Official documentation `Use relative paths (May not work!)`. C++ is brilliant! – Firanolfind Jun 13 '20 at 23:08
  • C++ has nothing to do with this, it is more CMake related (or even generator used). Anyways, starting from CMake 3.5 this variable has no effect at all. – arrowd Jun 14 '20 at 07:09