Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding moab download if not found via fetch content #964

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project(DAGMC)
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
enable_language(CXX)

# Set DAGMC version
Expand Down Expand Up @@ -59,7 +59,24 @@ if(BUILD_MCNP5 OR BUILD_MCNP6)
enable_language(Fortran)
endif()

find_package(MOAB REQUIRED)
# find_package(MOAB REQUIRED)

if (NOT MOAB_FOUND)
include(FetchContent)
message(STATUS "MOAB not found. Fetching MOAB...")
FetchContent_Declare(
moab
GIT_REPOSITORY https://bitbucket.org/fathomteam/moab.git
GIT_BRANCH master
# GIT_TAG 5.5.1
)
Copy link
Member Author

@shimwell shimwell Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we add HDF5 and other cmake args like this and then we can still use fetch

Suggested change
)
CMAKE_ARGS
-DENABLE_HDF5=ON
-DENABLE_NETCDF=ON
-DBUILD_SHARED_LIBS=OFF
-DENABLE_FORTRAN=OFF
-DENABLE_BLASLAPACK=OFF
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if it's a vaild command for FetchContent_Declare, but it is available in ExternalProject_Add. For more: https://discourse.cmake.org/t/fetchcontent-declare-with-cmake-args-does-not-work/11227/2

FetchContent_MakeAvailable(moab)
add_subdirectory(${moab_SOURCE_DIR} ${moab_BINARY_DIR}) # MOAB repository is not properly configured for a FetchContent build
# Set MOAB_DIR to the fetched content
set(MOAB_DIR ${moab_SOURCE_DIR})
find_package(MOAB REQUIRED)
endif()

find_package(OpenMP)

dagmc_setup_flags()
Expand Down
Loading