Skip to content

fix(cmake): use dependency targets for build-tree consumers#244

Open
liamnwhite1 wants to merge 1 commit intonmwsharp:masterfrom
liamnwhite1:fix/cmake-build-interface-dependency-targets
Open

fix(cmake): use dependency targets for build-tree consumers#244
liamnwhite1 wants to merge 1 commit intonmwsharp:masterfrom
liamnwhite1:fix/cmake-build-interface-dependency-targets

Conversation

@liamnwhite1
Copy link
Copy Markdown
Contributor

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

  • Replaced hardcoded dependency include paths with target-based links.
  • Linked Eigen3::Eigen and happly publicly for build-tree consumers.
  • Linked nanoflann and nanort privately for build-tree consumers.
  • Kept dependency target links scoped to BUILD_INTERFACE so 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 compatible Eigen3::Eigen, happly, nanoflann, or nanort targets.

The installed package path from #238 is preserved: installed consumers still use find_package(GeometryCentral CONFIG) and inherit Eigen3::Eigen through the generated package config.

I intentionally kept the build-tree include path absolute with ${CMAKE_CURRENT_SOURCE_DIR}/../include rather than using a relative $<BUILD_INTERFACE:../include>. CMake documents that relative paths are allowed inside INSTALL_INTERFACE, where they are interpreted relative to the install prefix, but relative paths should not be used inside BUILD_INTERFACE because they are not converted to absolute paths. See: https://cmake.org/cmake/help/latest/command/target_include_directories.html

Verification

  • Configured geometry-central with SUITESPARSE=OFF
  • Built geometry-central
  • Installed geometry-central
  • Verified downstream find_package(GeometryCentral REQUIRED CONFIG) smoke build
  • Verified downstream add_subdirectory() smoke build with predeclared dependency targets

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant