fix(cmake): use dependency targets for build-tree consumers#244
Open
liamnwhite1 wants to merge 1 commit intonmwsharp:masterfrom
Open
fix(cmake): use dependency targets for build-tree consumers#244liamnwhite1 wants to merge 1 commit intonmwsharp:masterfrom
liamnwhite1 wants to merge 1 commit intonmwsharp:masterfrom
Conversation
Replace hardcoded dependency include paths with build-interface target links for Eigen, happly, nanoflann, and nanort. This lets add_subdirectory() consumers override dependency targets while keeping the installed export clean for the GeometryCentral package.
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.
Summary
Fix
geometry-central's CMake target interface so build-tree consumers can override dependency targets while preserving the install/package behavior added for Nix.What Changed
Eigen3::Eigenandhapplypublicly for build-tree consumers.nanoflannandnanortprivately for build-tree consumers.BUILD_INTERFACEso the installed export remains clean.Why
This addresses concerns raised on #190 about #238 making
add_subdirectory()consumers use geometry-central's vendored dependency paths directly. Consumers can now provide their own compatibleEigen3::Eigen,happly,nanoflann, ornanorttargets.The installed package path from #238 is preserved: installed consumers still use
find_package(GeometryCentral CONFIG)and inheritEigen3::Eigenthrough the generated package config.I intentionally kept the build-tree include path absolute with
${CMAKE_CURRENT_SOURCE_DIR}/../includerather than using a relative$<BUILD_INTERFACE:../include>. CMake documents that relative paths are allowed insideINSTALL_INTERFACE, where they are interpreted relative to the install prefix, but relative paths should not be used insideBUILD_INTERFACEbecause they are not converted to absolute paths. See: https://cmake.org/cmake/help/latest/command/target_include_directories.htmlVerification
SUITESPARSE=OFFgeometry-centralfind_package(GeometryCentral REQUIRED CONFIG)smoke buildadd_subdirectory()smoke build with predeclared dependency targets