Skip to content

Commit

Permalink
Install the Core dlls as well on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
rpavlik committed Oct 27, 2015
1 parent 1d0b1a5 commit c4aa9ec
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ endif()
install(TARGETS driver_osvr
DESTINATION drivers/osvr/bin/${OPENVR_PLATFORM})

if(WIN32)
include(CopyImportedTarget)
foreach(target osvr::osvrClientKit osvr::osvrClient osvr::osvrCommon osvr::osvrUtil)
copy_imported_targets(${target}) # for use in build tree
install_imported_target(${target} DESTINATION drivers/osvr/bin/${OPENVR_PLATFORM}) # in installed directory
endforeach()
endif()

#
# Test program
#
Expand Down
32 changes: 32 additions & 0 deletions cmake/CopyImportedTarget.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# - 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 Ryan Pavlik <[email protected]> <[email protected]>
#
# Copyright Sensics, Inc. 2015.
# 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)

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()

0 comments on commit c4aa9ec

Please sign in to comment.