#
# LibG
#

set(LibG_DEPENDS "LibF")

ExternalProject_Include_Dependencies(LibG)


include(${CMAKE_CURRENT_SOURCE_DIR}/../ArtichokeTestUtility.cmake)
check_variable(proj "LibG")
check_variable(${proj}_DEPENDS "LibF")
check_variable(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} 1)

if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj_libd})
  unset(LibG_DIR CACHE)
endif()

# Sanity checks
if(DEFINED LibG_DIR AND NOT EXISTS ${LibG_DIR})
  message(FATAL_ERROR "LibG_DIR variable is defined but corresponds to non-existing directory")
endif()

if(NOT DEFINED LibD_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})

  message(FATAL_ERROR "Disabling ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} is not supported !")

else()
  ExternalProject_Add_Empty(${proj} DEPENDS "${${proj}_DEPENDS}")
endif()

mark_as_superbuild(
  VARS LibG_DIR:PATH
  LABELS "FIND_PACKAGE"
  )
