Add workaround for building executables with older CMake versions. #619
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.
Some time between CMake 3.16 and 3.17 the default behaviour seems to have changed as follows:
For a project which will build an executable, e.g.:
In 3.17, the invocation command to create the
exe_target
executable includes-Xlinker -rpath -Xlinkier <libA_path/lib>
and so forth for the linked libraries and their dependencies.In 3.16, the linker is not passed the rpath flags, so the executable ends up without the
LC_RPATH
required for it to run.This affects executable targets only, libraries do still have rpaths propagated correctly.
The correct solution (which will hopefully happen soon) is to bump the compiler's minimum CMake version to 3.18.
This is under discussion now here: https://forums.swift.org/t/bump-cmake-version-to-3-18