Skip to content

Fix order in which installation prefix is set

The installation prefix is overwritten in case the user does not specify and installation prefix themselves. This merge request makes sure that the prefix is overwritten before the GNUInstallDirs macro is included. This avoids problems with some CMake variable containing the default values of the GNUInstallDirs although the CMAKE_PREFIX_PATH has been overwritten. This was a problem, e.g., for the pkg-config file generation. Namely, the CMake variables CMAKE_INSTALL_FULL_LIBDIR and CMAKE_INSTALL_FULL_INCLUDEDIR would point to /usr/local/lib and /usr/local/include which leads to an invalid pkg-config file since OpenVDS would be installed to ${PROJECT_SOURCE_DIR}/Dist/OpenVDS instead.

I decided to move the code overwriting the default prefix into the CMakeLists.txt in the root directory instead of moving the include(GNUINstallDirs) below add_subdirectory(src). To me it felt more naturally to have code changing the CMake configuration in the main CMakeLists.txt as this setting is not specific to the actual source code. Let me know if you disagree with that. 😄

Edited by Alexander Jaust

Merge request reports