include(ExternalProject)
set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external)

ExternalProject_Add(mclproject
  GIT_REPOSITORY https://github.com/herumi/mcl.git
  CMAKE_ARGS
  -DMCL_USE_GMP=OFF
  -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION}
  -DCMAKE_INSTALL_RPATH=${EXTERNAL_INSTALL_LOCATION}/lib
  -DCMAKE_CXX_FLAGS=-fPIC
  INSTALL_COMMAND make install
)

install(DIRECTORY "${EXTERNAL_INSTALL_LOCATION}/include" DESTINATION ${CMAKE_INSTALL_PREFIX})
install(DIRECTORY "${EXTERNAL_INSTALL_LOCATION}/lib" DESTINATION ${CMAKE_INSTALL_PREFIX})

# Set variables for libgroupsig building
set(MCL_LIBRARY mcl)
set(MCL384_256_LIBRARY mclbn384_256)
