monado/src/xrt/targets/openxr/make_manifest.cmake

32 lines
1.1 KiB
CMake
Raw Normal View History

# SPDX-License-Identifier: BSL-1.0
# Get input from main CMake script
set(MANIFEST_INPUT @MANIFEST_INPUT@)
set(MANIFEST_RELATIVE_DIR @MANIFEST_RELATIVE_DIR@)
set(RUNTIME_RELATIVE_DIR @RUNTIME_RELATIVE_DIR@)
set(RUNTIME_FILENAME @RUNTIME_FILENAME@)
set(OPENXR_INSTALL_ABSOLUTE_RUNTIME_PATH @OPENXR_INSTALL_ABSOLUTE_RUNTIME_PATH@)
# Remove trailing slash
string(REGEX REPLACE "/$" "" MANIFEST_RELATIVE_DIR "${MANIFEST_RELATIVE_DIR}")
if(OPENXR_INSTALL_ABSOLUTE_RUNTIME_PATH)
# Absolute path to runtime
set(RUNTIME_PATH ${CMAKE_INSTALL_PREFIX}/${RUNTIME_RELATIVE_DIR}/${RUNTIME_FILENAME})
else()
# Relative path to runtime: requires it exist on the system shared library search path.
set(RUNTIME_PATH ${RUNTIME_FILENAME})
endif()
if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)
# Create manifest
configure_file(${MANIFEST_INPUT} ${CMAKE_CURRENT_LIST_DIR}/@RUNTIME_TARGET@.json)
# Install it
file(INSTALL
DESTINATION "${CMAKE_INSTALL_PREFIX}/${MANIFEST_RELATIVE_DIR}"
TYPE FILE
FILES "${CMAKE_CURRENT_LIST_DIR}/@RUNTIME_TARGET@.json")
endif()