macro(have_framework_target cnstream_root_path)
  if(TARGET cnstream_core)
    set(HAVE_FRAMEWORK_TARGET TRUE)
  else()
    if(NOT EXISTS ${cnstream_root_path}/lib/libcnstream_core.so)
      message(FATAL_ERROR "Build framework first")
    endif()
    link_directories(${cnstream_root_path}/lib)
  endif()
  include_directories(${cnstream_root_path}/framework/core/include)
endmacro()

macro(have_easydk_target cnstream_root_path)
  if(TARGET easydk)
    set(HAVE_EASYDK_TARGET TRUE)
  else()
    if(NOT EXISTS ${cnstream_root_path}/easydk/lib/libeasydk.so)
      message(FATAL_ERROR "Build easydk first")
    endif()
    link_directories(${cnstream_root_path}/easydk/lib)
  endif()
  include_directories(${cnstream_root_path}/easydk/include)
  include_directories(${cnstream_root_path}/easydk/infer_server/include)
  include_directories(${cnstream_root_path}/easydk/infer_server/contrib)
endmacro()

macro(have_modules_target cnstream_root_path)
  if(TARGET cnstream_va)
    set(HAVE_MODULES_TARGET TRUE)
  else()
    if(NOT EXISTS ${cnstream_root_path}/lib/libcnstream_va.so)
      message(FATAL_ERROR "Build modules first")
    endif()
    link_directories(${cnstream_root_path}/lib)
  endif()
endmacro()

macro(have_modules_contrib_target cnstream_root_path)
  if(TARGET cnstream_contrib)
    set(HAVE_MODULES_CONTRIB_TARGET TRUE)
    set(HAVE_MODULES_CONTRIB TRUE)
  else()
    if(EXISTS ${cnstream_root_path}/lib/libcnstream_contrib.so)
      set(HAVE_MODULES_CONTRIB TRUE)
      link_directories(${cnstream_root_path}/lib)
    endif()
  endif()
endmacro()
