Commit 1d1c0bbf authored by Ben Boeckel's avatar Ben Boeckel
Browse files

moab: use imported targets for CURL and HDF5

parent 61599a24
......@@ -32,6 +32,9 @@ superbuild_apply_patch(moab find-hdf5-default-path
superbuild_apply_patch(moab add-alternate-name-for-triangle
"Add ExodusII standard label TRIANGLE for triangle elements")
superbuild_apply_patch(moab ext-deps
"Re-find external dependencies when finding MOAB")
# By default, linux and os x cmake looks in <INSTALL_DIR>/lib/cmake for
# things. On windows, it does not. So, we set MOAB_DIR to point to the
# location of MOABConfig.cmake for everyone.
......
diff -u -Nru5 moab-6425a480ffe8e08b96453618fc5530e08e68ae8a/CMakeLists.txt moab-6425a480ffe8e08b96453618fc5530e08e68ae8a.ext-deps/CMakeLists.txt
--- moab-6425a480ffe8e08b96453618fc5530e08e68ae8a/CMakeLists.txt 2017-11-29 11:03:38.000000000 -0500
+++ moab-6425a480ffe8e08b96453618fc5530e08e68ae8a.ext-deps/CMakeLists.txt 2021-01-28 14:10:34.126074468 -0500
@@ -89,10 +89,11 @@
include ( CheckTypeSize )
# Compiler defines... this should really be in a config file.
set( MOAB_DEFINES "" )
set( MOAB_LIBS )
+set( MOAB_LIBS_CMAKE )
set( MOAB_INSTALL_TARGETS )
################################################################################
# Options that the user controls
################################################################################
@@ -267,12 +268,18 @@
if ( MOAB_HAVE_MPI )
set (MOAB_HAVE_HDF5_PARALLEL ON)
endif ( )
if ( CURL_FOUND )
set( HDF5_LIBRARIES ${HDF5_LIBRARIES} ${CURL_LIBRARIES} )
+ list(APPEND MOAB_LIBS_CMAKE CURL::libcurl)
endif ( CURL_FOUND )
set( MOAB_LIBS ${HDF5_LIBRARIES} ${MOAB_LIBS} )
+ if (TARGET HDF5::HDF5)
+ list(APPEND MOAB_LIBS_CMAKE HDF5::HDF5 )
+ else ()
+ list(APPEND MOAB_LIBS_CMAKE ${HDF5_LIBRARIES} )
+ endif ()
include_directories( ${HDF5_INCLUDE_DIR} src/io/mhdf/include )
endif ( ENABLE_HDF5 )
set (MOAB_HAVE_NETCDF OFF CACHE INTERNAL "Found necessary NetCDF components. Configure MOAB with it." )
set (MOAB_HAVE_PNETCDF OFF CACHE INTERNAL "Found necessary PNetCDF components. Configure MOAB with it." )
@@ -281,16 +288,18 @@
# set( MOAB_DEFINES "-DNETCDF_FILE ${MOAB_DEFINES}" )
set (MOAB_HAVE_NETCDF ON)
set (MOAB_HAVE_NETCDF_H 1)
include_directories( ${NETCDF_INCLUDES} )
set( MOAB_LIBS ${NETCDF_LIBRARIES} ${MOAB_LIBS} )
+ list(APPEND MOAB_LIBS_CMAKE ${NETCDF_LIBRARIES}) # FIXME: use imported target(s)
#
if ( PNETCDF_FOUND )
# find_package( PNetCDF REQUIRED )
set (MOAB_HAVE_PNETCDF ON)
include_directories( ${PNETCDF_INCLUDES} )
set( MOAB_LIBS ${PNETCDF_LIBRARIES} ${MOAB_LIBS} )
+ list(APPEND MOAB_LIBS_CMAKE ${PNETCDF_LIBRARIES}) # FIXME: use imported target(s)
endif ( PNETCDF_FOUND )
endif ( ENABLE_NETCDF )
set (MOAB_HAVE_METIS OFF CACHE INTERNAL "Found necessary Metis components. Configure MOAB with it." )
if ( ENABLE_METIS )
diff -u -Nru5 moab-6425a480ffe8e08b96453618fc5530e08e68ae8a/config/MOABConfig.cmake.cmake moab-6425a480ffe8e08b96453618fc5530e08e68ae8a.ext-deps/config/MOABConfig.cmake.cmake
--- moab-6425a480ffe8e08b96453618fc5530e08e68ae8a/config/MOABConfig.cmake.cmake 2017-11-29 11:03:38.000000000 -0500
+++ moab-6425a480ffe8e08b96453618fc5530e08e68ae8a.ext-deps/config/MOABConfig.cmake.cmake 2021-02-09 17:10:23.186246293 -0500
@@ -51,10 +51,34 @@
set(CGM_DIR "@CGM_DIR@")
set(ENABLE_IMESH @ENABLE_IMESH@)
set(ENABLE_IREL @ENABLE_IREL@)
set(ENABLE_FBIGEOM @ENABLE_FBIGEOM@)
+if (@ENABLE_HDF5@) # ENABLE_HDF5
+ set(_MOAB_install_dir "@CMAKE_INSTALL_LIBDIR@/cmake/MOAB")
+ set(_MOAB_install_prefix "${CMAKE_CURRENT_LIST_DIR}")
+ while (_MOAB_install_dir)
+ get_filename_component(_MOAB_install_prefix "${_MOAB_install_prefix}" DIRECTORY)
+ get_filename_component(_MOAB_install_dir "${_MOAB_install_dir}" DIRECTORY)
+ endwhile ()
+ unset(_MOAB_install_dir)
+
+ set(CMAKE_PREFIX_PATH_save_MOAB "${CMAKE_PREFIX_PATH}")
+ list(INSERT CMAKE_PREFIX_PATH 0
+ "${_MOAB_install_prefix}")
+ unset(_MOAB_install_prefix)
+
+ include(CMakeFindDependencyMacro)
+ find_dependency(HDF5)
+ if (@CURL_FOUND@) # CURL_FOUND
+ find_dependency(CURL)
+ endif ()
+
+ set(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH_save_MOAB}")
+ unset(CMAKE_PREFIX_PATH_save_MOAB)
+endif ()
+
set (MOAB_PACKAGE_LIBS "@ZOLTAN_LIBRARIES@ @PNETCDF_LIBRARIES@ @NETCDF_LIBRARIES@ @HDF5_LIBRARIES@ @PARMETIS_LIBRARIES@ @METIS_LIBRARIES@ @CGM_LIBRARIES@ @LAPACK_LIBRARIES@ @BLAS_LIBRARIES@ @MPI_CXX_LIBRARIES@" )
string(STRIP "${MOAB_PACKAGE_LIBS}" MOAB_PACKAGE_LIBS)
set(MOAB_PACKAGE_LIBS_LIST ${MOAB_PACKAGE_LIBS})
separate_arguments(MOAB_PACKAGE_LIBS_LIST)
list(REMOVE_DUPLICATES MOAB_PACKAGE_LIBS_LIST)
@@ -69,17 +93,10 @@
if(NOT TARGET MOAB AND NOT MOAB_BINARY_DIR)
include("${MOAB_CMAKE_DIR}/MOABTargets.cmake")
endif()
-# Target information
-if(MOAB_USE_HDF5)
- if(EXISTS "@HDF5_ROOT@/share/cmake/hdf5/hdf5-config.cmake")
- include(@HDF5_ROOT@/share/cmake/hdf5/hdf5-config.cmake)
- endif()
-endif()
-
set(MOAB_LIBRARY_DIRS, "@CMAKE_INSTALL_PREFIX@/lib")
set(MOAB_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include")
set(MOAB_LIBS "-lMOAB")
set(MOAB_LIBRARIES "-L@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ ${MOAB_LIBS} ${MOAB_PACKAGE_LIBS}")
if(ENABLE_IMESH)
diff -u -Nru5 moab-6425a480ffe8e08b96453618fc5530e08e68ae8a/src/CMakeLists.txt moab-6425a480ffe8e08b96453618fc5530e08e68ae8a.ext-deps/src/CMakeLists.txt
--- moab-6425a480ffe8e08b96453618fc5530e08e68ae8a/src/CMakeLists.txt 2017-11-29 11:03:38.000000000 -0500
+++ moab-6425a480ffe8e08b96453618fc5530e08e68ae8a.ext-deps/src/CMakeLists.txt 2021-01-28 13:59:47.907762658 -0500
@@ -279,11 +279,11 @@
SOVERSION ${MOAB_VERSION_MAJOR}
)
target_link_libraries(
MOAB
- ${CMAKE_EXE_LINKER_FLAGS} ${MOAB_DEP_LIBRARIES} ${MOAB_LIBS} ${MOAB_CGM_LIBS} ${MPI_LIBRARIES} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES}
+ ${CMAKE_EXE_LINKER_FLAGS} ${MOAB_DEP_LIBRARIES} ${MOAB_LIBS_CMAKE} ${MOAB_CGM_LIBS} ${MPI_LIBRARIES} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES}
)
install(
TARGETS MOAB
EXPORT MOABTargets
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5dbd4517..0ee987ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -272,6 +272,7 @@ if ( ENABLE_HDF5 )
endif ( CURL_FOUND )
set( MOAB_LIBS ${HDF5_LIBRARIES} ${MOAB_LIBS} )
diff -u -Nru5 moab-6425a480ffe8e08b96453618fc5530e08e68ae8a.ext-deps/CMakeLists.txt moab-6425a480ffe8e08b96453618fc5530e08e68ae8a.hdf5-library-type/CMakeLists.txt
--- moab-6425a480ffe8e08b96453618fc5530e08e68ae8a.ext-deps/CMakeLists.txt 2021-01-28 14:10:34.126074468 -0500
+++ moab-6425a480ffe8e08b96453618fc5530e08e68ae8a.hdf5-library-type/CMakeLists.txt 2021-02-15 17:16:38.300505447 -0500
@@ -277,10 +277,11 @@
list(APPEND MOAB_LIBS_CMAKE HDF5::HDF5 )
else ()
list(APPEND MOAB_LIBS_CMAKE ${HDF5_LIBRARIES} )
endif ()
include_directories( ${HDF5_INCLUDE_DIR} src/io/mhdf/include )
+ add_definitions(-DH5_BUILT_AS_DYNAMIC_LIB)
endif ( ENABLE_HDF5 )
set (MOAB_HAVE_NETCDF OFF CACHE INTERNAL "Found necessary NetCDF components. Configure MOAB with it." )
set (MOAB_HAVE_PNETCDF OFF CACHE INTERNAL "Found necessary PNetCDF components. Configure MOAB with it." )
if ( ENABLE_NETCDF )
......@@ -7,8 +7,8 @@ diff -Nr -U5 src/src/CMakeLists.txt src.new/src/CMakeLists.txt
target_link_libraries(
MOAB
- ${CMAKE_EXE_LINKER_FLAGS} ${MOAB_DEP_LIBRARIES} ${MOAB_LIBS} ${MOAB_CGM_LIBS} ${MPI_LIBRARIES} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES}
+ ${MOAB_DEP_LIBRARIES} ${MOAB_LIBS} ${MOAB_CGM_LIBS} ${MPI_LIBRARIES} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES}
- ${CMAKE_EXE_LINKER_FLAGS} ${MOAB_DEP_LIBRARIES} ${MOAB_LIBS_CMAKE} ${MOAB_CGM_LIBS} ${MPI_LIBRARIES} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES}
+ ${MOAB_DEP_LIBRARIES} ${MOAB_LIBS_CMAKE} ${MOAB_CGM_LIBS} ${MPI_LIBRARIES} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES}
)
install(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment