Skip to content

Commit

Permalink
additional metkit-configs checks
Browse files Browse the repository at this point in the history
  • Loading branch information
danovaro committed Nov 21, 2024
1 parent fbbd9b8 commit 804472a
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,34 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
########################################################################################################################
### dependencies and options

if (METKIT_CONFIGS_PATH)
file( CREATE_LINK "${METKIT_CONFIGS_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/share" SYMBOLIC )
if(NOT METKIT_CONFIGS_BRANCH)
set(METKIT_CONFIGS_BRANCH main)
endif()

if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/share")
if(IS_SYMLINK "${CMAKE_CURRENT_SOURCE_DIR}/share")
if (METKIT_CONFIGS_PATH)
#check if it matches with METKIT_CONFIGS_PATH
file(REAL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/share" current_metkit_config_path EXPAND_TILDE)
file(REAL_PATH "${METKIT_CONFIGS_PATH}" requested_metkit_config_path EXPAND_TILDE)
if(NOT (current_metkit_config_path STREQUAL requested_metkit_config_path))
message(SEND_ERROR "metkit-configs refers to ${current_metkit_config_path}; requested METKIT_CONFIGS_PATH is ${requested_metkit_config_path}")
endif()
endif()
elseif(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/share")
# update the content
ecbuild_bundle( PROJECT share GIT "https://github.com/ecmwf/metkit-configs" BRANCH "${METKIT_CONFIGS_BRANCH}" UPDATE )
else()
message(SEND_ERROR "${CMAKE_CURRENT_SOURCE_DIR}/share must point to a valid metkit configuration. Cannot be a regular file")
endif()
else()
if(NOT METKIT_CONFIGS_BRANCH)
set(METKIT_CONFIGS_BRANCH main)
if(METKIT_CONFIGS_PATH)
file( CREATE_LINK "${METKIT_CONFIGS_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/share" SYMBOLIC )
else()
ecbuild_bundle( PROJECT share GIT "https://github.com/ecmwf/metkit-configs" BRANCH "${METKIT_CONFIGS_BRANCH}" UPDATE )
endif()
ecbuild_bundle( PROJECT share GIT "https://github.com/ecmwf/metkit-configs" BRANCH "${METKIT_CONFIGS_BRANCH}" UPDATE )
endif()


ecbuild_add_option( FEATURE BUILD_TOOLS
DEFAULT ON
DESCRIPTION "Build the command line tools" )
Expand Down

0 comments on commit 804472a

Please sign in to comment.