@@ -104,6 +104,9 @@ endif()
104104
105105project (IfcOpenShell VERSION ${RELEASE_VERSION} )
106106
107+ # Make sure CMake modules in this project are found first
108+ list (PREPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR} )
109+
107110if (MINIMAL_BUILD)
108111 message (STATUS "Setting options for minimal build" )
109112 set (BUILD_GEOMSERVER OFF )
@@ -730,91 +733,7 @@ endif()
730733
731734
732735if (HDF5_SUPPORT)
733- if ("${HDF5_INCLUDE_DIR} " STREQUAL "" )
734- message (STATUS "No HDF5 include directory specified" )
735- else ()
736- set (HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIR} " CACHE FILEPATH "HDF5 header files" )
737- endif ()
738-
739- if ("${HDF5_LIBRARY_DIR} " STREQUAL "" )
740- message (STATUS "No HDF5 library directory specified" )
741- else ()
742- set (HDF5_LIBRARY_DIR "${HDF5_LIBRARY_DIR} " CACHE FILEPATH "HDF5 library files" )
743- endif ()
744-
745- if (HDF5_LIBRARY_DIR)
746- # result of the HDF5 ctest package
747- # Find zlib using cmake find_library. How should this be implemented?
748- # FIND_LIBRARY(NAMES z libz libz_debug PATHS ... NO_DEFAULT_PATH)
749- if ("$ENV{CONDA_BUILD} " STREQUAL "" )
750- # result of the HDF5 ctest package
751- if (WIN32 )
752- set (zlib_post lib)
753- set (lib_ext lib)
754- else ()
755- set (lib_ext a)
756- endif ()
757-
758- if ("${CMAKE_BUILD_TYPE} " STREQUAL "Debug" )
759- set (debug_postfix "_debug" )
760- endif ()
761-
762- set (HDF5_LIBRARIES
763- "${HDF5_LIBRARY_DIR} /libhdf5_cpp${debug_postfix} .${lib_ext} "
764- "${HDF5_LIBRARY_DIR} /libhdf5${debug_postfix} .${lib_ext} "
765- "${HDF5_LIBRARY_DIR} /libz${zlib_post}${debug_postfix} .${lib_ext} "
766- "${HDF5_LIBRARY_DIR} /libsz${debug_postfix} .${lib_ext} "
767- "${HDF5_LIBRARY_DIR} /libaec${debug_postfix} .${lib_ext} "
768- )
769-
770- else ()
771- message (STATUS "Packaging hdf5 and zlib for conda distribution" )
772-
773- if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
774- # macOS
775- set (zlib_post libz)
776- set (lib_ext dylib)
777- set (HDF5_LIBRARIES
778- "${HDF5_LIBRARY_DIR} /libhdf5_cpp.${lib_ext} "
779- "${HDF5_LIBRARY_DIR} /libhdf5.${lib_ext} "
780- "${HDF5_LIBRARY_DIR} /${zlib_post} .${lib_ext} "
781- )
782- else ()
783- # linux and windows
784- # Find HDF5 package
785- find_package (HDF5 REQUIRED COMPONENTS C CXX )
786- # Find ZLIB package
787- find_package (ZLIB REQUIRED )
788- # Include directories
789- include_directories (${HDF5_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} )
790- # Link libraries
791- set (HDF5_LIBRARIES ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} )
792- message (STATUS "HDF5 libraries: ${HDF5_LIBRARIES} " )
793- endif ()
794- endif ()
795- endif ()
796-
797- if (NOT HDF5_INCLUDE_DIR OR NOT HDF5_LIBRARY_DIR)
798- # First try to find it as a config.
799- find_package (HDF5 CONFIG )
800- if (HDF5_DIR)
801- message (STATUS "HDF5: found config at '${HDF5_DIR} '." )
802- set (HDF5_LIBRARIES hdf5_cpp-static)
803- else ()
804- # If it failed, still try to find as a module.
805- # E.g. on Ubuntu `libhdf5-dev` doesn't provie hdf5-config.cmake.
806- # Will automatically fill HDF5_LIBRARIES and HDF5_INCLUDE_DIR.
807- find_package (HDF5 COMPONENTS CXX )
808- if (NOT HDF5_INCLUDE_DIR)
809- message (
810- FATAL_ERROR
811- "HDF5_INCLUDE_DIR is not provided (current value: '${HDF5_INCLUDE_DIR} '). "
812- "HDF5_LIBRARY_DIR is not provided (current value: '${HDF5_LIBRARY_DIR} '). "
813- "Also could not find HDF5 package (neither module or config)."
814- )
815- endif ()
816- endif ()
817- endif ()
736+ find_package (HDF5 REQUIRED COMPONENTS C CXX )
818737
819738 add_definitions (-DWITH_HDF5 )
820739 set (SWIG_DEFINES ${SWIG_DEFINES} -DWITH_HDF5)
@@ -948,7 +867,7 @@ endif()
948867
949868
950869include_directories (${INCLUDE_DIRECTORIES} ${OCC_INCLUDE_DIR} ${OPENCOLLADA_INCLUDE_DIRS}
951- ${Boost_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIR} ${JSON_INCLUDE_DIR} ${HDF5_INCLUDE_DIR }
870+ ${Boost_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIR} ${JSON_INCLUDE_DIR} ${HDF5_INCLUDE_DIRS }
952871 ${EIGEN_DIR} ${CGAL_INCLUDE_DIR} ${GMP_INCLUDE_DIR} ${MPFR_INCLUDE_DIR} ${USD_INCLUDE_DIR}
953872 ${TBB_INCLUDE_DIR}
954873)
0 commit comments