In static builds find_package(Eigen3) is skipped, leaving Eigen3::Eigen undefined when admesh and clipper try to link against it. Add an unconditional find_package(Eigen3 CONFIG QUIET) guard in the main CMakeLists before add_subdirectory(deps_src). deps_src/eigen now simply provides the unnamespaced alias and fatals clearly if the target is missing.
15 lines
537 B
CMake
15 lines
537 B
CMake
cmake_minimum_required(VERSION 3.13)
|
|
project(eigen)
|
|
|
|
# Eigen3::Eigen is resolved in the parent CMakeLists before add_subdirectory(deps_src)
|
|
# via find_package(Eigen3 CONFIG). This file only creates the unnamespaced "eigen" alias.
|
|
if(NOT TARGET Eigen3::Eigen)
|
|
message(FATAL_ERROR "Eigen3::Eigen target not found. "
|
|
"Ensure find_package(Eigen3 CONFIG) is called before add_subdirectory(deps_src).")
|
|
endif()
|
|
|
|
if(NOT TARGET eigen)
|
|
add_library(eigen INTERFACE)
|
|
target_link_libraries(eigen INTERFACE Eigen3::Eigen)
|
|
endif()
|