bitcoin/cmake/module/InstallBinaryComponent.cmake

32 lines
984 B
CMake

# Copyright (c) 2025-present The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://opensource.org/license/mit/.
include_guard(GLOBAL)
include(GNUInstallDirs)
function(install_binary_component target)
cmake_parse_arguments(PARSE_ARGV 1
IC # prefix
"HAS_MANPAGE;INTERNAL" # options
"" # one_value_keywords
"" # multi_value_keywords
)
string(MAKE_C_IDENTIFIER ${target} component)
if(IC_INTERNAL)
set(runtime_dest ${CMAKE_INSTALL_LIBEXECDIR})
else()
set(runtime_dest ${CMAKE_INSTALL_BINDIR})
endif()
install(TARGETS ${target}
RUNTIME DESTINATION ${runtime_dest}
COMPONENT ${component}
)
if(INSTALL_MAN AND IC_HAS_MANPAGE)
install(FILES ${PROJECT_SOURCE_DIR}/doc/man/${target}.1
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
COMPONENT ${component}
)
endif()
endfunction()