From ec1c2289e56cff542dfe0fd9b22071f4352f6a9f Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Fri, 13 May 2022 16:00:59 -0500 Subject: [PATCH] Eigen includes are needed in more places. Also remove erroneous redundant extlib/eigen mentions. --- CMakeLists.txt | 8 ++++---- src/CMakeLists.txt | 7 +++++-- test/CMakeLists.txt | 3 +++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f08e95f..399e2cae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,9 +185,6 @@ endif() message(STATUS "Using in-tree libdxfrw") add_subdirectory(extlib/libdxfrw) -message(STATUS "Using in-tree eigen") -include_directories(extlib/eigen) - message(STATUS "Using in-tree mimalloc") set(MI_OVERRIDE OFF CACHE BOOL "") set(MI_BUILD_SHARED OFF CACHE BOOL "") @@ -199,13 +196,16 @@ set(MIMALLOC_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/extlib/mimalloc/include) if(NOT FORCE_VENDORED_Eigen3) find_package(Eigen3 CONFIG) endif() -if(FORCE_VENDORED_Eigen3 OR NOT EIGEN3_FOUND) +if(FORCE_VENDORED_Eigen3 OR NOT EIGEN3_INCLUDE_DIRS) message(STATUS "Using in-tree Eigen") set(EIGEN3_FOUND YES) set(EIGEN3_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extlib/eigen) else() message(STATUS "Using system Eigen: ${EIGEN3_INCLUDE_DIRS}") endif() +if(NOT EXISTS "${EIGEN3_INCLUDE_DIRS}") + message(FATAL_ERROR "Eigen 3 not found on system or in-tree") +endif() if(WIN32 OR APPLE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0c0277ee..41c40d03 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -82,7 +82,9 @@ target_compile_definitions(slvs PRIVATE -DLIBRARY) target_include_directories(slvs - PUBLIC ${CMAKE_SOURCE_DIR}/include) + PUBLIC + ${CMAKE_SOURCE_DIR}/include + ${EIGEN3_INCLUDE_DIRS}) target_link_libraries(slvs PRIVATE slvs_deps) @@ -336,7 +338,8 @@ target_compile_definitions(solvespace-headless PRIVATE HEADLESS) target_include_directories(solvespace-headless - INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) + INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} + PUBLIC ${EIGEN3_INCLUDE_DIRS}) target_link_libraries(solvespace-headless PRIVATE diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index db812bfa..eb6cf60b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -76,6 +76,9 @@ target_link_libraries(solvespace-testsuite solvespace-headless ${COVERAGE_LIBRARY}) +target_include_directories(solvespace-testsuite + PRIVATE + ${EIGEN3_INCLUDE_DIRS}) add_dependencies(solvespace-testsuite resources)