Changeset View
Changeset View
Standalone View
Standalone View
cmake/modules/InstallationHelper.cmake
# This file contains facilities for installing the files. | # This file contains facilities for installing the files. | ||||
include(GNUInstallDirs) | include(GNUInstallDirs) | ||||
include(SanitizeHelper) | include(SanitizeHelper) | ||||
function(_add_install_target COMPONENT) | function(_add_install_target COMPONENT) | ||||
sanitize_target_name("install-" "${COMPONENT}" INSTALL_TARGET) | sanitize_target_name("install-" "${COMPONENT}" INSTALL_TARGET) | ||||
if(NOT TARGET ${INSTALL_TARGET}) | if(NOT TARGET ${INSTALL_TARGET}) | ||||
add_custom_target(${INSTALL_TARGET} | add_custom_target(${INSTALL_TARGET} | ||||
COMMENT "Installing component ${COMPONENT}" | COMMENT "Installing component ${COMPONENT}" | ||||
COMMAND | COMMAND | ||||
"${CMAKE_COMMAND}" | "${CMAKE_COMMAND}" | ||||
-E env CMAKE_INSTALL_ALWAYS=ON | |||||
"${CMAKE_COMMAND}" | |||||
-DCOMPONENT="${COMPONENT}" | -DCOMPONENT="${COMPONENT}" | ||||
-DCMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}" | -DCMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}" | ||||
-P cmake_install.cmake | -P cmake_install.cmake | ||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" | WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" | ||||
) | ) | ||||
if(TARGET install-all) | if(TARGET install-all) | ||||
add_dependencies(install-all ${INSTALL_TARGET}) | add_dependencies(install-all ${INSTALL_TARGET}) | ||||
endif() | endif() | ||||
endif() | endif() | ||||
# Other arguments are additional dependencies | # Other arguments are additional dependencies | ||||
if(ARGN) | if(ARGN) | ||||
add_dependencies(${INSTALL_TARGET} ${ARGN}) | add_dependencies(${INSTALL_TARGET} ${ARGN}) | ||||
endif() | endif() | ||||
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | |||||
if(NOT TARGET "install-${COMPONENT}-debug") | |||||
add_custom_target("install-${COMPONENT}-debug" | |||||
COMMENT "Splitting out the debug symbols for component ${COMPONENT}" | |||||
COMMAND | |||||
"${CMAKE_SOURCE_DIR}/cmake/utils/split-installed-component.sh" | |||||
"${CMAKE_BINARY_DIR}/contrib/devtools/split-debug.sh" | |||||
"${CMAKE_BINARY_DIR}/install_manifest_${COMPONENT}.txt" | |||||
DEPENDS | |||||
"${INSTALL_TARGET}" | |||||
"${CMAKE_BINARY_DIR}/contrib/devtools/split-debug.sh" | |||||
) | |||||
endif() | |||||
if(TARGET install-debug) | |||||
add_dependencies(install-debug "install-${COMPONENT}-debug") | |||||
endif() | |||||
endif() | |||||
endfunction() | endfunction() | ||||
function(install_target _target) | function(install_target _target) | ||||
cmake_parse_arguments(ARG | cmake_parse_arguments(ARG | ||||
"" | "" | ||||
"COMPONENT" | "COMPONENT" | ||||
"" | "" | ||||
${ARGN} | ${ARGN} | ||||
▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines |