
IF(DOWNLOAD)
  ExternalProject_Add(viennamaterials
    PREFIX viennamaterials
    GIT_REPOSITORY https://github.com/viennamaterials/viennamaterials-dev.git
    GIT_TAG next
    BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/viennamaterials"
    CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_VIENNASTAR_SHARED} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DBUILD_PYTHON_LIBRARY=ON -DBUILD_PYTHON_BACKEND=OFF -DBUILD_UNITS=ON
    INSTALL_COMMAND ""
  )
  ExternalProject_Get_Property(viennamaterials SOURCE_DIR)
  ExternalProject_Get_Property(viennamaterials BINARY_DIR)
ELSE(DOWNLOAD)
  ExternalProject_Add(viennamaterials
    PREFIX viennamaterials
    SOURCE_DIR $ENV{VIENNAMATERIALSPATH}
    BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/viennamaterials"
    CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_VIENNASTAR_SHARED} -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DBUILD_PYTHON_LIBRARY=OFF -DBUILD_PYTHON_BACKEND=ON -DBUILD_UNITS=ON
    INSTALL_COMMAND ""
  )
  ExternalProject_Get_Property(viennamaterials SOURCE_DIR)
  ExternalProject_Get_Property(viennamaterials BINARY_DIR)
ENDIF(DOWNLOAD)


SET(VIENNAMATERIALS_INCLUDE_DIRS ${SOURCE_DIR})

IF(BUILD_VIENNASTAR_SHARED)
  set(LIBSUFFIX ".so")
ELSE(BUILD_VIENNASTAR_SHARED)
  set(LIBSUFFIX ".a")
ENDIF(BUILD_VIENNASTAR_SHARED)

SET(VIENNAMATERIALS_LIBRARIES ${BINARY_DIR}/${CMAKE_FIND_LIBRARY_PREFIXES}viennamaterials${LIBSUFFIX} ${PYTHON_LIBRARY})
