Fix Boost link flags in pkg-config file. #6083
Merged
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.
Issue
In newer versions of cmake, FindBoost uses Imported Targets for library component variables, rather than file paths to the Boost libraries.
cmake uses these targets when linking (e.g.
target_link_library
) and knows how to correctly substitute the values. However, the OSRM pkg-config file that we generate doesn't do this, and ends up writing the actual target symbols, hence the errors trying to linkBoost::<component>
.To fix this for newer cmake versions, we create an intermediate configure step that references TARGET_LINKER_FILE for each imported target. This is followed by a
file(GENERATE
step that performs the correct substitution.See this thread for more details: https://cmake.org/pipermail/cmake/2018-December/068812.html
This is backwards compatible to the existing min cmake version (3.1). However, building using cmake 3.1 fails with an unrelated package.json parsing error:
Given 3.1 is nearly 7 years old, I don't think it's worth investigating. Instead, this PR also bumps the min version to 3.2.
Tasklist
Requirements / Relations
Fixes #5687