From 7f8a1dfa8adc8c897a36bf6afdff868e9126b30b Mon Sep 17 00:00:00 2001 From: Biljana Bojovic Date: Mon, 13 Feb 2023 19:53:51 +0100 Subject: [PATCH] cmake: Fix that allows FindEigen3.cmake to be executed With this fix in the macros-and-definition script, FindEigen3.cmake can be executed when needed, and hence allows using custom Eigen 3rd-party library instead of default installation version. I.e. it is enough to simply place eigen in some folder, and then running export EIGEN3_ROOT=/some/folder/eigen before compiling will allow the FindEigen3.cmake script to find it. --- build-support/macros-and-definitions.cmake | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/build-support/macros-and-definitions.cmake b/build-support/macros-and-definitions.cmake index 1215c2161..840b9d415 100644 --- a/build-support/macros-and-definitions.cmake +++ b/build-support/macros-and-definitions.cmake @@ -646,19 +646,6 @@ macro(process_options) endif() endif() - set(ENABLE_EIGEN False) - if(${NS3_EIGEN}) - find_package(Eigen3 QUIET) - - if(${EIGEN3_FOUND}) - set(ENABLE_EIGEN True) - add_definitions(-DHAVE_EIGEN3) - include_directories(${EIGEN3_INCLUDE_DIR}) - else() - message(${HIGHLIGHTED_STATUS} "Eigen was not found") - endif() - endif() - if(${NS3_NATIVE_OPTIMIZATIONS} AND ${GCC}) add_compile_options(-march=native -mtune=native) endif() @@ -729,6 +716,19 @@ macro(process_options) ) list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/build-support/3rd-party") + set(ENABLE_EIGEN False) + if(${NS3_EIGEN}) + find_package(Eigen3 QUIET) + + if(${EIGEN3_FOUND}) + set(ENABLE_EIGEN True) + add_definitions(-DHAVE_EIGEN3) + include_directories(${EIGEN3_INCLUDE_DIR}) + else() + message(${HIGHLIGHTED_STATUS} "Eigen was not found") + endif() + endif() + # GTK3 Don't search for it if you don't have it installed, as it take an # insane amount of time if(${NS3_GTK3})