Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When running CMake without setting CMAKE_INSTALL_PREFIX, and then running CMake again with a different prefix, the install path for the pkgconfig files still points to the old location.
Because the default
/usr/local
prefix on Linux requires root access, installing SFML without sudo will fail with an error like this:This was fixed in the CSFML project a few weeks ago (see SFML/CSFML#233 and SFML/CSFML#234), this PR applies the same fix to SFML.
This change is NOT backwards compatible. The existing
SFML_PKGCONFIG_INSTALL_PREFIX
variable will no longer work and is being replaced with a newSFML_PKGCONFIG_INSTALL_DIR
variable in cmake.Tasks
How to test this PR?
On linux you can run the following commands to get the error:
cmake -S . -B build cmake --build build cmake --install build --prefix whatever
On other platforms you can probably also witness the files being installed to the wrong directory, but you will need to set
SFML_INSTALL_PKGCONFIG_FILES
toON
yourself because it is only enabled by default on Linux and BSD.