add_executable(imageSegSimple    imageSegSimple.cxx            ${headers})
add_executable(imageSegWithEMLearning imageSegWithEMLearning.cxx   ${headers})

if(WITH_HDF5)
  add_executable(buildFoE buildFoE.cxx   ${headers})
  target_link_libraries(buildFoE ${HDF5_LIBRARIES}) 
endif()


find_package(VIGRA)	
IF(VIGRA_FOUND)
  #file(GLOB_RECURSE mrfheaders utility/*.hxx)
  #include_directories(utility)
  include_directories(${VIGRA_INCLUDE_DIR})
  if(WITH_HDF5)
    message(STATUS "build with mrf-benchmark")
    #add_executable(photomontage photomontage.cxx ${headers} ${mrfheaders} ${VIGRA_INCLUDE_DIR}) 
    add_executable(photomontage-stitching photomontage-stitching.cxx ${headers}  ${VIGRA_INCLUDE_DIR}) 
    add_executable(photomontage-merging photomontage-merging.cxx ${headers} ${VIGRA_INCLUDE_DIR})
    add_executable(denoise denoise.cxx ${headers} ${mrfheaders} ${VIGRA_INCLUDE_DIR})
    
    target_link_libraries(photomontage-stitching ${HDF5_CORE_LIBRARY} ${VIGRA_IMPEX_LIBRARY}) 
    target_link_libraries(photomontage-merging ${HDF5_CORE_LIBRARY} ${VIGRA_IMPEX_LIBRARY}) 
    target_link_libraries(denoise ${HDF5_LIBRARIES} ${VIGRA_IMPEX_LIBRARY}) 
    if(UNIX)
      if(LINK_RT)
        find_library(RT_LIBRARY rt)
        target_link_libraries(photomontage-stitching rt)
        target_link_libraries(photomontage-merging rt)
        target_link_libraries(denoise rt)
      endif()
    endif()
  else()
    message(STATUS "mrf-benchmark can only be built with HDF5. set WITH_HDF5 to build to HDF5.")
  endif()
endif()
