diff --git a/cmake/FindCMOR.cmake b/cmake/FindCMOR.cmake new file mode 100644 index 0000000000000000000000000000000000000000..b2209335b608f62fe196abed51692fe39af433af --- /dev/null +++ b/cmake/FindCMOR.cmake @@ -0,0 +1,30 @@ +find_library( + CMOR_LIBRARY + NAMES cmor + DOC "Climate Model Output Rewriter" +) +mark_as_advanced(CMOR_LIBRARY) + + +find_path(CMOR_INCLUDE_DIR + NAMES cmor.h + DOC "CMOR3 include directory" +) +mark_as_advanced(CMOR_INCLUDE_DIR) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + CMOR + REQUIRED_VARS CMOR_LIBRARY CMOR_INCLUDE_DIR +) +if(NOT TARGET CMOR::CMOR) + add_library(CMOR::CMOR UNKNOWN IMPORTED ) + + target_link_libraries(CMOR::CMOR INTERFACE ${CMOR_LIBRARY} Uuid::uuid Udunits::udunits netCDF::netcdf) + target_include_directories(CMOR::CMOR INTERFACE "${CMOR_INCLUDE_DIR}") + + set_target_properties(CMOR::CMOR PROPERTIES + IMPORTED_LOCATION "${CMOR_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${CMOR_INCLUDE_DIR}") + +endif() diff --git a/cmake/FindUdunits.cmake b/cmake/FindUdunits.cmake new file mode 100644 index 0000000000000000000000000000000000000000..d66155aab6b566ccf0efaf95726700a3226d6b1a --- /dev/null +++ b/cmake/FindUdunits.cmake @@ -0,0 +1,25 @@ +include(FindPackageHandleStandardArgs) + +find_library(Udunits_LIBRARY NAMES udunits2) +find_path(Udunits_INCLUDE_DIR NAMES udunits2.h) +find_package_handle_standard_args(Udunits DEFAULT_MSG Udunits_LIBRARY Udunits_INCLUDE_DIR) + +if(NOT TARGET Udunits::udunits) + add_library(Udunits::udunits UNKNOWN IMPORTED) + + + target_link_libraries(Udunits::udunits INTERFACE ${Udunits_LIBRARIES}) + target_include_directories(Udunits::udunits INTERFACE "${Udunits_INCLUDE_DIR}") + + set_target_properties(Udunits::udunits PROPERTIES + IMPORTED_LOCATION "${Udunits_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${Udunits_INCLUDE_DIR}") + + mark_as_advanced( + Udunits_LIBRARIES + Udunits_INCLUDE_DIR + ) + unset(UDUNITS2) +endif() + + diff --git a/cmake/FindUuid.cmake b/cmake/FindUuid.cmake new file mode 100644 index 0000000000000000000000000000000000000000..9b045a6acad5aee587ad8796305907774e35e5b2 --- /dev/null +++ b/cmake/FindUuid.cmake @@ -0,0 +1,22 @@ +find_library(Uuid_LIBRARY NAMES uuid) +find_path(Uuid_INCLUDE_DIR NAMES uuid.h) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Uuid DEFAULT_MSG Uuid_LIBRARY Uuid_INCLUDE_DIR) + + + +if(NOT TARGET Uuid::uuid) + add_library(Uuid::uuid UNKNOWN IMPORTED) + + target_link_libraries(Uuid::uuid INTERFACE ${Uuid_LIBRARIES}) + target_include_directories(Uuid::uuid INTERFACE "${Uuid_INCLUDE_DIRS}") + + set_target_properties(Uuid::uuid PROPERTIES + IMPORTED_LOCATION "${Uuid_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${Uuid_INCLUDE_DIR}") +endif() +mark_as_advanced( +Uuid_LIBRARIES +Uuid_INCLUDE_DIR +) +