Fix Boost link flags in pkg-config file.#6083
Merged
mjjbell merged 1 commit intoProject-OSRM:masterfrom Sep 3, 2021
Merged
Conversation
TheMarex
approved these changes
Sep 3, 2021
| @@ -1,4 +1,4 @@ | |||
| cmake_minimum_required(VERSION 3.1) | |||
| cmake_minimum_required(VERSION 3.2) | |||
Member
There was a problem hiding this comment.
Seems fine, we can probably even go higher if that makes things easier, given most people build this in docker images anyway.
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 link Boost::<component>. To fix this for newer cmake versions, we create an intermediate configure step that references the linker files for the imported targets. This is followed by a 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 a package.json parsing error, so this commit also bumps the min version to 3.2.
7847bbe to
98f7b0d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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(GENERATEstep 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