File: GitSubmodule.cmake

package info (click to toggle)
cp2k 2025.2-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 372,052 kB
  • sloc: fortran: 963,262; ansic: 64,495; f90: 21,676; python: 14,419; sh: 11,382; xml: 2,173; makefile: 953; pascal: 845; perl: 492; cpp: 345; lisp: 297; csh: 16
file content (30 lines) | stat: -rw-r--r-- 1,513 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!-------------------------------------------------------------------------------------------------!
#!   CP2K: A general program to perform molecular dynamics simulations                             !
#!   Copyright 2000-2025 CP2K developers group <https://cp2k.org>                                  !
#!                                                                                                 !
#!   SPDX-License-Identifier: GPL-2.0-or-later                                                     !
#!-------------------------------------------------------------------------------------------------!

# Call to ensure that the git submodule in location `path` is loaded. If the
# submodule is not loaded, an error message that describes how to update the
# submodules is printed. Sets the variable name_avail to `ON` if the submodule
# is available, or `OFF` otherwise. copyright github.com/arbor-sim

function(check_git_submodule name path)
  set(success_var "${name}_avail")
  set(${success_var}
      ON
      PARENT_SCOPE)

  get_filename_component(dotgit "${path}/.git" ABSOLUTE)
  if(NOT EXISTS ${dotgit})
    message(
      FATAL_ERROR
        "\nThe git submodule for ${name} is not available.\n"
        "To check out all submodules use the following commands:\n"
        "    git submodule init\n"
        "    git submodule update\n"
        "Or download submodules recursively when checking out:\n"
        "    git clone --recursive https://github.com/cp2k/cp2k.git\n")
  endif()
endfunction()