File: CopyImportedTarget.cmake

package info (click to toggle)
freespace2 25.0.0~rc11%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 47,232 kB
  • sloc: cpp: 657,500; ansic: 22,305; sh: 293; python: 200; makefile: 198; xml: 181
file content (35 lines) | stat: -rw-r--r-- 1,140 bytes parent folder | download | duplicates (2)
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
31
32
33
34
35
# - Copy shared libraries from imported targets to the target build directory
# on Windows during post-build. Install them in all cases.
#
#  copy_imported_targets(<target_name> [<imported target name> ...])
#
#  install_imported_target(<imported target name> <arguments to pass to install(FILES))
#
# Likely requires CMake 2.8.12 or newer to work well.
#
# Original Author:
# 2015 Rylie Pavlik <rylie@ryliepavlik.com>
#
# Copyright 2015, Sensics, Inc.
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# SPDX-License-Identifier: BSL-1.0

function(copy_imported_targets _target)
    foreach(_dep ${ARGN})
        if(WIN32)
            add_custom_command(TARGET ${_target} POST_BUILD
                COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${_dep}> $<TARGET_FILE_DIR:${_target}>
                COMMENT "Copying required DLL for dependency ${_dep}"
                VERBATIM)
        endif()
    endforeach()
endfunction()


function(install_imported_target _dep)
    install(FILES $<TARGET_FILE:${_dep}> ${ARGN})
endfunction()