InstallBinaryComponent.cmake raw

   1  # Copyright (c) 2025-present The Limenka 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"     # options
  12      ""                # one_value_keywords
  13      ""                # multi_value_keywords
  14    )
  15    set(target_name ${component})
  16    install(TARGETS ${target_name}
  17      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  18      COMPONENT ${component}
  19    )
  20    if(INSTALL_MAN AND IC_HAS_MANPAGE)
  21      install(FILES ${PROJECT_SOURCE_DIR}/doc/man/${target_name}.1
  22        DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
  23        COMPONENT ${component}
  24      )
  25    endif()
  26  endfunction()
  27