set(SQLPP11_INSTALL_DIR ${CMAKE_THIRD_PARTY_DIR})

ExternalProject_Add(
  sqlpp11
  GIT_REPOSITORY https://github.com/rbock/sqlpp11
  GIT_TAG 0.58
  CMAKE_ARGS -G ${CMAKE_GENERATOR} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DHinnantDate_INCLUDE_DIR=${DATE_INCLUDE_DIR} -DCMAKE_INSTALL_PREFIX=${SQLPP11_INSTALL_DIR} -DENABLE_TESTS=OFF
  INSTALL_DIR ${SQLPP11_INSTALL_DIR}
  DEPENDS DATE::DATE
)

ExternalProject_Get_Property(
  sqlpp11
  install_dir
)

set(SQLPP11_EXE_PATH "${install_dir}/bin/sqlpp11-ddl2cpp")
set(SQLPP11_INCLUDE_DIR "${install_dir}/include")
if(NOT TARGET SQLPP11::SQLPP11)
  add_library(SQLPP11::SQLPP11 INTERFACE IMPORTED)
  add_dependencies(SQLPP11::SQLPP11 sqlpp11)
  set_target_properties(SQLPP11::SQLPP11 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SQLPP11_INCLUDE_DIR}")
endif()