From 3331e8996a8b912b5a09b9864570d46e07ccd8ce Mon Sep 17 00:00:00 2001 From: Lars Bilke Date: Tue, 10 Sep 2024 10:02:22 +0200 Subject: [PATCH] [cmake] Only apply mgis patch when CPM_SOURCE_CACHE is defined. See https://github.com/cpm-cmake/CPM.cmake/issues/577. Should fix issues observed by various developers. --- scripts/cmake/Dependencies.cmake | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/cmake/Dependencies.cmake b/scripts/cmake/Dependencies.cmake index bdb90b55b73..686b384af8b 100644 --- a/scripts/cmake/Dependencies.cmake +++ b/scripts/cmake/Dependencies.cmake @@ -165,15 +165,22 @@ if(OGS_USE_MFRONT) find_package(MFrontGenericInterface REQUIRED) else() set(CMAKE_REQUIRE_FIND_PACKAGE_TFEL TRUE) + # Patch only works when CPM_SOURCE_CACHE is set. Following conditional + # logic can be removed if + # https://github.com/cpm-cmake/CPM.cmake/issues/577 is resolved. + if(NOT "${CPM_SOURCE_CACHE}" STREQUAL "") + set(_mgis_patch_args + PATCHES ${PROJECT_SOURCE_DIR}/scripts/cmake/mgis-flags.patch + ) + message(STATUS "Adding mgis-flags.patch.") + endif() CPMAddPackage( NAME MGIS GITHUB_REPOSITORY thelfer/MFrontGenericInterfaceSupport GIT_TAG rliv-2.0 OPTIONS "enable-doxygen-doc OFF" "enable-fortran-bindings OFF" "enable-website OFF" - EXCLUDE_FROM_ALL - YES SYSTEM TRUE PATCHES - ${PROJECT_SOURCE_DIR}/scripts/cmake/mgis-flags.patch + EXCLUDE_FROM_ALL YES SYSTEM TRUE ${_mgis_patch_args} ) list(APPEND DISABLE_WARNINGS_TARGETS MFrontGenericInterface) endif()