Fix CMake so that Eigen discovery and linking is consistent #1314
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.
This fixes the issue that was encountered after merging #1304 since that PR unearthed this subtle bug. Kudos to @OznOg for helping with this.
The issue is that Eigen is being
find_package
d twice, and if the first one is the system Eigen, it keeps using that even if the USE_SYSTEM_EIGEN flag is set to OFF.As a result, the version set by CMake is the 3rdparty one, but GTSAM is compiled against the system Eigen, hence version mismatch.
Easy fix is to just not do the first
find_package
since that is being used to set a default flag value (which is now OFF directly). KISS