# install the headers that we specified with FILE_SET (header files for the user to include in their projects)
install(TARGETS ${CMAKE_PROJECT_NAME}
  EXPORT complexNumbersTargets
  FILE_SET HEADERS
  COMPONENT complexLib
)

# provide some basic meta data about the library to generate the library's config file 
install(
  EXPORT complexNumbersTargets
  FILE complexNumbersTargets.cmake
  DESTINATION "lib/cmake/complexNumbers"
  NAMESPACE complexNumbers::
  COMPONENT complexLib
)

# generate the library's config file
include(CMakePackageConfigHelpers)
configure_package_config_file(
  cmake/complexNumbersConfig.cmake.in
  "${CMAKE_CURRENT_BINARY_DIR}/complexNumbersConfig.cmake"
  INSTALL_DESTINATION "lib/cmake/complexNumbers"
)

# install the config file
install(
  FILES "${CMAKE_CURRENT_BINARY_DIR}/complexNumbersConfig.cmake"
  DESTINATION "lib/cmake/complexNumbers"
  COMPONENT complexLib
)

# install the documentation if requested
if (BUILD_DOCS)
  install(
    DIRECTORY ${CMAKE_BINARY_DIR}/docs/html
    DESTINATION docs/complexNumberLib/
    COMPONENT documentation
  )
endif(BUILD_DOCS)