From 526ca4bb3240621a0c86f404ec4bb9ee559cabc2 Mon Sep 17 00:00:00 2001 From: foxtran <39676482+foxtran@users.noreply.github.com> Date: Sun, 1 Sep 2024 12:56:24 +0200 Subject: [PATCH] Fetch ecbuild if not downloaded before --- CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e5290fa0..434b0b2af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,18 @@ cmake_minimum_required( VERSION 3.12 FATAL_ERROR ) -find_package( ecbuild 3.7 REQUIRED HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild) +find_package( ecbuild 3.7 HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild) +if(NOT ecbuild_FOUND) + message(STATUS "Fetching ecbuild...") + include(FetchContent) + FetchContent_Declare( + ecbuild + GIT_REPOSITORY https://github.com/ecmwf/ecbuild.git + GIT_TAG 3.8.5 + ) + FetchContent_MakeAvailable(ecbuild) + find_package( ecbuild 3.7 REQUIRED ) +endif() # Initialise project project( eccodes LANGUAGES CXX )