Skip to content

Commit

Permalink
Cleaned toplevel cmakelists
Browse files Browse the repository at this point in the history
  • Loading branch information
shutsch committed Feb 25, 2024
1 parent da2d44a commit effd2f9
Showing 1 changed file with 8 additions and 33 deletions.
41 changes: 8 additions & 33 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,8 @@ if (IMAGINEMODELS_COMPILE_TESTS)
if (Catch2_FOUND)
message("-- global installation of catch2 library found. Tests will be compiled.")
else()
message("-- no global installation of catch2 library found. Trying to include it as a submodule.")
set(INTERNAL_findCatch2_DIR ${PROJECT_SOURCE_DIR}/extern/Catch2)
if(NOT EXISTS ${INTERNAL_findCatch2_DIR})
message("The catch2 submodule was not found! Please run 'git submodule update --init'. Alternatively you can install catch2 globally on your system. Will proceed without compiling the tests." )
set(IMAGINEMODELS_COMPILE_TESTS OFF)
else()
add_subdirectory(${INTERNAL_findCatch2_DIR})
message("-- catch2 library found as a submodule. Tests will be compiled.")
set(Catch2_FOUND ON)
endif()
message("-- The catch2 submodule was not found! Will proceed without compiling the tests." )
set(IMAGINEMODELS_COMPILE_TESTS OFF)
endif()
else()
set(Catch2_FOUND OFF)
Expand All @@ -53,23 +45,15 @@ endif()
if (IMAGINEMODELS_USE_AUTODIFF)
find_package(Eigen3 NO_MODULE)
if(NOT Eigen3_FOUND)
message("-- Could not find Eigen3 library globally! Trying to include it as a submodule.")
set(EIGEN_PATH ${PROJECT_SOURCE_DIR}/extern/Eigen3/cmake)
if(NOT EXISTS ${EIGEN_PATH})
message("The Eigen3 submodule was not found! Please run 'git submodule update --init' OR set the EIGEN_PATH variable to the eigen header files manually. Will proceed with autodifferentiation disabled." )
set(IMAGINEMODELS_USE_AUTODIFF OFF)
set(autodiff_FOUND OFF)
else()
message("-- Eigen3 library found as a submodule at ${EIGEN_PATH}. Trying to find autodiff now.")
set(Eigen3_FOUND ON)
endif()
message("-- Could not find Eigen3 library! Will proceed with autodifferentiation disabled.")
set(IMAGINEMODELS_USE_AUTODIFF OFF)
set(autodiff_FOUND OFF)
else()
message("-- Eigen3 library at ${EIGEN_PATH} found. Trying to find autodiff now.")
endif()

list(APPEND CMAKE_PREFIX_PATH ${EIGEN_PATH})
set(Eigen3_DIR ${EIGEN_PATH})
message("-- CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ")

if (Eigen3_FOUND)

Expand All @@ -78,19 +62,10 @@ if (IMAGINEMODELS_USE_AUTODIFF)
message("-- Trying to find autodiff. Turn off via setting 'IMAGINEMODELS_USE_AUTODIFF=OFF' in your environment before installation. ")
find_package(autodiff)
if (autodiff_FOUND)
message("-- global installation of the autodiff library found: attempting to find Eigen3.")
message("-- installation of the autodiff library found. Autodifferentiation will be enabled")
else()
message("-- no global installation of autodiff library found. Trying to include it as a submodule.")
set(INTERNAL_findautodiff_DIR ${PROJECT_SOURCE_DIR}/extern/autodiff)
if(NOT EXISTS ${INTERNAL_findautodiff_DIR})
message("The autodiff submodule was not found! Please run 'git submodule update --init'. Alternatively you can install autodiff globally on your system." )
set(IMAGINEMODELS_USE_AUTODIFF OFF)
set(autodiff_FOUND OFF)
else()
add_subdirectory(${INTERNAL_findautodiff_DIR})
message("-- autodiff library found as a submodule. Tests will be compiled.")
set(autodiff_FOUND ON)
endif()
message("-- The autodiff library was not found! Will proceed with autodifferentiation disabled." )
set(IMAGINEMODELS_USE_AUTODIFF OFF)
endif()
endif()
else()
Expand Down

0 comments on commit effd2f9

Please sign in to comment.