summaryrefslogtreecommitdiffstats
path: root/cmake/FindDocker.cmake
blob: ef3046db09d68690045217a6bd95b69795a6833a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (C) 2020 Manuel Bentele <development@manuel-bentele.de>
#

find_program(Docker_EXECUTABLE NAMES docker)

if(Docker_EXECUTABLE)
    execute_process(COMMAND docker version --format "{{.Server.Version}}"
                    OUTPUT_VARIABLE Docker_VERSION
                    OUTPUT_STRIP_TRAILING_WHITESPACE)
endif(Docker_EXECUTABLE)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Docker
                                  FOUND_VAR Docker_FOUND
                                  REQUIRED_VARS Docker_EXECUTABLE
                                  VERSION_VAR Docker_VERSION
                                  FAIL_MESSAGE "Docker is not available! Please install docker to build and run containers!")