Is it possible to install binaries in one location and cmake packages in another one for third-party libraries?


For my own codes, I design my CMakeLists to install the binaries in their own place while the cmake packages are put in a single folder which plays the role of a registry.

But is it possible to do the same thing for a third-party library for which I don’t want to modify its CMakeLists?


Not in general, no. Many projects do offer CMAKE_INSTALL_* variables to change where things get installed though.

Hi and thanks for the answer.

Indeed CMAKE_INSTALL_ vars are available but when setting CMAKE_INSTALL_LIBDIR changes the location of the library binary but also of the CMake package directory, which is undesired.

I feel that it should be distinct properties. Don’t you think? Does it deserve to open a feature request?


Not all projects are fully controllable like that and will just derive the path like that. A pattern like this is what you probably need projects to do; this project may just be forcing the “if not set” part.