AntMau
AntMau

Reputation: 305

Retrieve build directory used to create a given package

It is a generic question and not even sure it is relevant but my knowledge about CMake is very limited.

I am working with a package that has been built and installed using CMake. We modified the installation directory using:

-DCMAKE_INSTALL_PREFIX:PATH=<path_I_want_the_package_to_be_installed>

However, in my case, I only know the location of the install directory. Is there a way, from the install directory to trace back the build directory we used to install it?

Upvotes: 0

Views: 240

Answers (1)

Alex Reinking
Alex Reinking

Reputation: 20046

No, CMake does not store this information in the install tree. By design, it should be possible to delete the build tree once installed, so placing a dangling reference in the install tree would be troublesome. It would also conflict with creating release packages with CPack and risk leaking private info about your build machine.

If you want to manually store this information, there's nothing stopping you from writing the value of ${CMAKE_BINARY_DIR} to a file and then writing an install() rule for it.

Also, CMake does store information about the install tree inside the build tree, so you might be able to find it as a one-off by searching your filesystem for every file named install_manifest.txt and grepping each one for your install prefix. That might not be unique, but it would potentially help you recover that information in some scenarios.

Upvotes: 1

Related Questions