Allow overriding the install command to install symlinks instead of copying files
I'm setting up an ExternalProject superbuild for KDE development. Being a superbuild, all projects have to be installed to allow other projects to find them using find_package()
. A side effect of this is that the compilation databases generated by CMake will point to include directories (usr/include) in the install directory. This means that if we execute Go-To Definition in a project on a symbol provided by another project, the IDE will navigate to the copy of the header file in the install directory instead of to the original header file in the source directory.
I had the same problem with a SCons build in the past and I managed to solve the problem there by having SCons install the header files as symlinks to the original header files in the source directory. The IDE can resolve the symlink and navigate to the original file in the source directory. Could we add an option (CMAKE_INSTALL_SYMLINKS
?) to allow telling CMake from the command line to install header files (or all files) as symlinks to enable this use case?
This also saves disk space when using CMake superbuilds as we're not copying files from the build directory to the install directory. For a large superbuild such as the KDE one, this can end up saving more than 3GB in disk space when doing a debug build.
Of course, this option would only work on platforms that support symlinks (I'm not sure if symlinks in Windows are sufficiently mature yet).