find_package(Eigen3 REQUIRED)
# Add as "system headers" to avoid warnings generated by them with
# compilers that support that notion.
include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR})

if(USE_SPGLIB)
  find_package(Spglib REQUIRED)
  include_directories(SYSTEM ${SPGLIB_INCLUDE_DIR})
endif()

# configure the version header
configure_file("${PROJECT_SOURCE_DIR}/cmake/version.h.in"
  "${CMAKE_CURRENT_BINARY_DIR}/version.h")

set(HEADERS
  color3f.h
  array.h
  atom.h
  atomtyper.h
  atomtyper-inline.h
  avogadrocore.h
  basisset.h
  bond.h
  coordinateset.h
  coordinateblockgenerator.h
  crystaltools.h
  cube.h
  elements.h
  gaussianset.h
  gaussiansettools.h
  graph.h
  matrix.h
  mesh.h
  molecule.h
  mutex.h
  nameatomtyper.h
  residue.h
  ringperceiver.h
  slaterset.h
  slatersettools.h
  spacegroups.h
  symbolatomtyper.h
  types.h
  unitcell.h
  utilities.h
  variant.h
  variant-inline.h
  variantmap.h
  vector.h
  "${CMAKE_CURRENT_BINARY_DIR}/version.h"
)

set(SOURCES
  coordinateblockgenerator.cpp
  crystaltools.cpp
  cube.cpp
  elements.cpp
  gaussianset.cpp
  gaussiansettools.cpp
  graph.cpp
  mesh.cpp
  mdlvalence_p.h
  molecule.cpp
  mutex.cpp
  nameatomtyper.cpp
  residue.cpp
  ringperceiver.cpp
  slaterset.cpp
  slatersettools.cpp
  spacegroups.cpp
  symbolatomtyper.cpp
  unitcell.cpp
  variantmap.cpp
  version.cpp
)

if(USE_SPGLIB)
  list(APPEND HEADERS avospglib.h)
  list(APPEND SOURCES avospglib.cpp)
endif()

avogadro_add_library(AvogadroCore ${HEADERS} ${SOURCES})
target_link_libraries(AvogadroCore LINK_PRIVATE ${SPGLIB_LIBRARY})
