InstallBinaryComponent.cmake raw

   1  # Copyright (c) 2025-present The Bitcoin Core developers
   2  # Distributed under the MIT software license, see the accompanying
   3  # file COPYING or https://opensource.org/license/mit/.
   4  
   5  include_guard(GLOBAL)
   6  include(GNUInstallDirs)
   7  
   8  function(install_binary_component component)
   9    cmake_parse_arguments(PARSE_ARGV 1
  10      IC                          # prefix
  11      "HAS_MANPAGE;INTERNAL"      # options
  12      ""                          # one_value_keywords
  13      ""                          # multi_value_keywords
  14    )
  15    set(target_name ${component})
  16    if(IC_INTERNAL)
  17      set(runtime_dest ${CMAKE_INSTALL_LIBEXECDIR})
  18    else()
  19      set(runtime_dest ${CMAKE_INSTALL_BINDIR})
  20    endif()
  21    install(TARGETS ${target_name}
  22      RUNTIME DESTINATION ${runtime_dest}
  23      COMPONENT ${component}
  24    )
  25    if(INSTALL_MAN AND IC_HAS_MANPAGE)
  26      install(FILES ${PROJECT_SOURCE_DIR}/doc/man/${target_name}.1
  27        DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
  28        COMPONENT ${component}
  29      )
  30    endif()
  31  endfunction()
  32