diff --git a/cmake/FindMOAB.cmake b/cmake/FindMOAB.cmake index d5fcddc72..db19e53e4 100644 --- a/cmake/FindMOAB.cmake +++ b/cmake/FindMOAB.cmake @@ -10,49 +10,18 @@ find_path(MOAB_CMAKE_CONFIG PATHS ${MOAB_SEARCH_DIRS} NO_DEFAULT_PATH ) - -# First check if we are forcing the download of MOAB -if (PULL_INSTALL_MOAB) - if(DAGMC_BUILD_STATIC_LIBS) - message(FATAL_ERROR "PULL_INSTALL_MOAB is ONLY compatible with shared libraries.") - endif() - if(NOT MOAB_VERSION) - set(MOAB_VERSION "5.5.1") - endif() - include(MOAB_PullAndMake) - moab_pull_make(${MOAB_VERSION}) - -# Back to normal behavior -elseif (MOAB_CMAKE_CONFIG) +if (MOAB_CMAKE_CONFIG) set(MOAB_CMAKE_CONFIG ${MOAB_CMAKE_CONFIG}/MOABConfig.cmake) - include(${MOAB_CMAKE_CONFIG}) message(STATUS "MOAB_CMAKE_CONFIG: ${MOAB_CMAKE_CONFIG}") else () message(FATAL_ERROR "Could not find MOAB. Set -DMOAB_DIR= when running cmake or use the $MOAB_DIR environment variable.") endif () # Find HDF5 -set(ENV{PATH} "${HDF5_DIR}:$ENV{PATH}") -set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX}) -find_package(HDF5 REQUIRED) -# Remove HDF5 transitive dependencies that are system libraries -list(FILTER HDF5_LIBRARIES EXCLUDE REGEX ".*lib(pthread|dl|m).*") -set(HDF5_LIBRARIES_SHARED ${HDF5_LIBRARIES}) -# CMake doesn't let you find_package(HDF5) twice so we have to do this instead -if (BUILD_STATIC_LIBS) - string(REPLACE ${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_STATIC_LIBRARY_SUFFIX} - HDF5_LIBRARIES_STATIC "${HDF5_LIBRARIES_SHARED}") -endif () -if (NOT BUILD_SHARED_LIBS) - set(HDF5_LIBRARIES_SHARED) -endif () -set(HDF5_LIBRARIES) - -message(STATUS "HDF5_INCLUDE_DIRS: ${HDF5_INCLUDE_DIRS}") -message(STATUS "HDF5_LIBRARIES_SHARED: ${HDF5_LIBRARIES_SHARED}") -message(STATUS "HDF5_LIBRARIES_STATIC: ${HDF5_LIBRARIES_STATIC}") +include(${MOAB_CMAKE_CONFIG}) +include(HDF5_macro) +find_set_HDF5() -include_directories(${HDF5_INCLUDE_DIRS}) if(MSVC) set(BUILD_STATIC_LIBS TRUE) set(BUILD_SHARED_LIBS OFF) @@ -84,9 +53,7 @@ message(STATUS "MOAB_LIBRARY_DIRS: ${MOAB_LIBRARY_DIRS}") message(STATUS "MOAB_LIBRARIES_SHARED: ${MOAB_LIBRARIES_SHARED}") message(STATUS "MOAB_LIBRARIES_STATIC: ${MOAB_LIBRARIES_STATIC}") -if(PULL_INSTALL_MOAB) - message(STATUS "MOAB will be downloaded and built at make time") -elseif (MOAB_INCLUDE_DIRS AND (MOAB_LIBRARIES_SHARED OR NOT BUILD_SHARED_LIBS) AND +if (MOAB_INCLUDE_DIRS AND (MOAB_LIBRARIES_SHARED OR NOT BUILD_SHARED_LIBS) AND (MOAB_LIBRARIES_STATIC OR NOT BUILD_STATIC_LIBS)) message(STATUS "Found MOAB") else () diff --git a/cmake/MOAB_PullAndMake.cmake b/cmake/MOAB_PullAndMake.cmake index 62b4244a7..fa1c2c76f 100644 --- a/cmake/MOAB_PullAndMake.cmake +++ b/cmake/MOAB_PullAndMake.cmake @@ -55,8 +55,9 @@ MACRO (moab_pull_make) PUBLIC_HEADER DESTINATION ${INSTALL_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${MOAB_INCLUDE_DIRS}) LINK_DIRECTORIES(${MOAB_LIBRARY_DIRS}) - FIND_PACKAGE(Eigen3 REQUIRED NO_MODULE) - INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIRS}) + + # FIND_PACKAGE(Eigen3 REQUIRED NO_MODULE) + # INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIRS}) # Find HDF5 INCLUDE(HDF5_macro) @@ -73,8 +74,6 @@ MACRO (moab_pull_make) MESSAGE(STATUS "MOAB_LIBRARY_DIRS: ${MOAB_LIBRARY_DIRS}") MESSAGE(STATUS "MOAB_LIBRARIES_SHARED: ${MOAB_LIBRARIES_SHARED}") - INCLUDE_DIRECTORIES(${MOAB_INCLUDE_DIRS}) - ENDMACRO(moab_pull_make)