CedaConfig.cmake

get_filename_component(Ceda_CMAKE "${CMAKE_CURRENT_LIST_FILE}" PATH)
include(CMakeFindDependencyMacro)


####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was CedaConfig.cmake                            ########

get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../" ABSOLUTE)

macro(set_and_check _var _file)
  set(${_var} "${_file}")
  if(NOT EXISTS "${_file}")
    message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
  endif()
endmacro()

macro(check_required_components _NAME)
  foreach(comp ${${_NAME}_FIND_COMPONENTS})
    if(NOT ${_NAME}_${comp}_FOUND)
      if(${_NAME}_FIND_REQUIRED_${comp})
        set(${_NAME}_FOUND FALSE)
      endif()
    endif()
  endforeach()
endmacro()

####################################################################################
set(CEDA_DIR "")

list(APPEND CMAKE_MODULE_PATH ${Ceda_CMAKE})

# NOTE Had to use find_package because find_dependency does not support COMPONENTS or MODULE until 3.8.0
#find_dependency(Boost 1.67 REQUIRED COMPONENTS regex)
#find_package(Boost 1.67 REQUIRED COMPONENTS atomic chrono system thread filesystem locale)

list(REMOVE_AT CMAKE_MODULE_PATH -1)

if(TARGET Ceda::cxUtils)
    message("*********** Target Ceda::cxUtils already defined *****************")
endif()

if(NOT TARGET Ceda::cxUtils)
    message("*********** including CedaTargets.cmake *****************")
    include("${Ceda_CMAKE}/CedaTargets.cmake")
    include("${Ceda_CMAKE}/CedaCommon.cmake")

    # Ceda_SDK       = C:/Program Files/Ceda/android-arm64-v8a
    # Ceda_CMAKE     = C:/Program Files/Ceda/android-arm64-v8a/cmake
    # Ceda_BIN       = C:/Program Files/Ceda/android-arm64-v8a/bin
    # Ceda_LIB       = C:/Program Files/Ceda/android-arm64-v8a/lib
    # Ceda_INCLUDE   = C:/Program Files/Ceda/android-arm64-v8a/include
    # Ceda_EXPORT    = C:/Program Files/Ceda/android-arm64-v8a/export
    # Ceda_HOST_BIN  = C:/Program Files/Ceda/windows-x64/bin
    # Ceda_XCPP      = C:/Program Files/Ceda/windows-x64/bin/Xcpp

    set(Ceda_SDK        "${Ceda_CMAKE}/..")

    set(Ceda_BIN        "${Ceda_SDK}/bin")
    set(Ceda_LIB        "${Ceda_SDK}/lib")
    set(Ceda_INCLUDE    "${Ceda_SDK}/include")
    set(Ceda_EXPORT     "${Ceda_SDK}/export")
    set(Ceda_XCPPCONFIG "${Ceda_SDK}/export/XcppBuild/XcppConfig")

    set(Ceda_HOST_BIN   "${Ceda_SDK}/../windows-x64/bin")
    set(Ceda_XCPP       "${Ceda_HOST_BIN}/Xcpp")

    # Add the CedaSDK export folder to the virtual tree
    cedaAddSourceRoot("${Ceda_EXPORT}")
endif()

set(Ceda_LIBRARIES 
        Ceda::cxBuild
        Ceda::cxCedaScript
        Ceda::cxLss 
        Ceda::cxMacroExpander
        Ceda::cxMessage 
        Ceda::cxObject 
        Ceda::cxOperation 
        Ceda::cxPersistStore 
        Ceda::cxPython 
        Ceda::cxRmi
        Ceda::cxSocket 
        Ceda::cxThread 
        Ceda::cxUtils 
        Ceda::cxWorkingSetIpc) 

check_required_components(Ceda)