From bb113ac7a07a5e1333a43e612a2ae174e19927b7 Mon Sep 17 00:00:00 2001 From: Liam White Date: Mon, 4 May 2026 09:38:09 -0400 Subject: [PATCH] fix(cmake): use dependency targets for build-tree consumers 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. --- src/CMakeLists.txt | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 51d06110..aa03b305 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -175,23 +175,21 @@ SET(HEADERS # Create a single library for the project add_library(geometry-central ${SRCS} ${HEADERS}) -# Public headers include vendored headers directly, so build-tree consumers need -# those include roots explicitly. The install tree collapses them under the -# single installed include directory. target_include_directories(geometry-central PUBLIC $ - $ - $ - $ + $) + +target_link_libraries(geometry-central + PUBLIC + $ + $ PRIVATE - "${CMAKE_CURRENT_SOURCE_DIR}/../deps/nanoflann/include" - "${CMAKE_CURRENT_SOURCE_DIR}/../deps/nanort/include" -) + $ + $) -# Keep Eigen out of the exported build-tree link interface to avoid exporting the -# local helper target created in deps/CMakeLists.txt. The installed package adds -# Eigen3::Eigen back after calling find_dependency(Eigen3). +# Keep build-tree dependency targets out of the installed export. The installed +# package adds Eigen3::Eigen back after calling find_dependency(Eigen3). # Set compiler properties for the library target_compile_features(geometry-central PUBLIC cxx_std_11)