set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE)

if("${CPACK_MCASM_DEBIAN_PACKAGE}" STREQUAL "lib")
  set(CPACK_DEBIAN_PACKAGE_NAME "libmcasm")
  set(CPACK_PACKAGE_FILE_NAME "libmcasm")
  set(CPACK_COMPONENTS_ALL library)
  set(CPACK_DEBIAN_PACKAGE_DEPENDS "libstdc++6, libc6, libgcc1")
elseif("${CPACK_MCASM_DEBIAN_PACKAGE}" STREQUAL "lib-dbg")
  set(CPACK_DEBIAN_PACKAGE_NAME "libmcasm-dbg")
  set(CPACK_PACKAGE_FILE_NAME "libmcasm-dbg")
  set(CPACK_COMPONENTS_ALL mcasm-debug-file)
  set(CPACK_DEBIAN_PACKAGE_DEPENDS "libmcasm (=${CPACK_MCASM_VERSION})")
elseif("${CPACK_MCASM_DEBIAN_PACKAGE}" STREQUAL "dev")
  set(CPACK_DEBIAN_PACKAGE_NAME "libmcasm-dev")
  set(CPACK_PACKAGE_FILE_NAME "libmcasm-dev")
  set(CPACK_COMPONENTS_ALL headers cmake_config cmake_target)
  set(CPACK_DEBIAN_PACKAGE_DEPENDS
      "libstdc++6, libc6, libgcc1, libmcasm (=${CPACK_MCASM_VERSION})")
elseif("${CPACK_MCASM_DEBIAN_PACKAGE}" STREQUAL "driver")
  set(CPACK_DEBIAN_PACKAGE_NAME "mcasm-driver")
  set(CPACK_PACKAGE_FILE_NAME "mcasm-driver")
  set(CPACK_COMPONENTS_ALL driver)
  set(CPACK_DEBIAN_PACKAGE_DEPENDS
      "libstdc++6, libc6, libgcc1, libmcasm (=${CPACK_MCASM_VERSION})")
elseif("${CPACK_MCASM_DEBIAN_PACKAGE}" STREQUAL "driver-dbg")
  set(CPACK_DEBIAN_PACKAGE_NAME "mcasm-driver-dbg")
  set(CPACK_PACKAGE_FILE_NAME "mcasm-driver-dbg")
  set(CPACK_COMPONENTS_ALL mcasm-driver-debug-file)
  set(CPACK_DEBIAN_PACKAGE_DEPENDS "mcasm-driver (=${CPACK_MCASM_VERSION})")
endif()
