libssh2

Форк
0
/
CopyRuntimeDependencies.cmake 
71 строка · 2.6 Кб
1
# Copyright (C) Alexander Lamaison <alexander.lamaison@gmail.com>
2
#
3
# Redistribution and use in source and binary forms,
4
# with or without modification, are permitted provided
5
# that the following conditions are met:
6
#
7
#   Redistributions of source code must retain the above
8
#   copyright notice, this list of conditions and the
9
#   following disclaimer.
10
#
11
#   Redistributions in binary form must reproduce the above
12
#   copyright notice, this list of conditions and the following
13
#   disclaimer in the documentation and/or other materials
14
#   provided with the distribution.
15
#
16
#   Neither the name of the copyright holder nor the names
17
#   of any other contributors may be used to endorse or
18
#   promote products derived from this software without
19
#   specific prior written permission.
20
#
21
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
22
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
23
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
26
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
33
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
34
# OF SUCH DAMAGE.
35
#
36
# SPDX-License-Identifier: BSD-3-Clause
37

38
include(CMakeParseArguments)
39

40
function(add_target_to_copy_dependencies)
41
  set(options)
42
  set(oneValueArgs TARGET)
43
  set(multiValueArgs DEPENDENCIES BEFORE_TARGETS)
44
  cmake_parse_arguments(COPY
45
    "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
46

47
  if(NOT COPY_DEPENDENCIES)
48
    return()
49
  endif()
50

51
  # Using a custom target to drive custom commands stops multiple
52
  # parallel builds trying to kick off the commands at the same time
53
  add_custom_target(${COPY_TARGET})
54

55
  foreach(target IN LISTS COPY_BEFORE_TARGETS)
56
    add_dependencies(${target} ${COPY_TARGET})
57
  endforeach()
58

59
  foreach(dependency IN LISTS COPY_DEPENDENCIES)
60
    add_custom_command(
61
      TARGET ${COPY_TARGET}
62
      DEPENDS ${dependency}
63
      # Make directory first otherwise file is copied in place of
64
      # directory instead of into it
65
      COMMAND ${CMAKE_COMMAND}
66
      ARGS -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
67
      COMMAND ${CMAKE_COMMAND}
68
      ARGS -E copy ${dependency} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
69
      VERBATIM)
70
  endforeach()
71
endfunction()
72

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.