IF(OPENEXR_INCLUDE_DIR)
  MESSAGE("Got first")
ENDIF(OPENEXR_INCLUDE_DIR)
IF(ILMIMF_LIBRARY)
  MESSAGE("Got second")
ELSE(ILMIMF_LIBRARY)
  MESSAGE("Check: " ${ILMIMF_LIRARY})
ENDIF(ILMIMF_LIBRARY)

IF(OPENEXR_INCLUDE_DIR AND ILMIMF_LIBRARY)

  SET(INC_DIR ${INC_DIR} ${OPENEXR_INCLUDE_DIR})

  INCLUDE_DIRECTORIES( ${INC_DIR} )

  ADD_EXECUTABLE(openexr chroma_icc.cxx  openexr.cxx)
  SET_TARGET_PROPERTIES(openexr PROPERTIES LINKER_LANGUAGE CXX)
  TARGET_LINK_LIBRARIES(openexr lib libhalf wire ${GTK_LIBRARIES} 
                                ${ILMIMF_LIBRARY} ${LCMS})
  INSTALL(TARGETS openexr
          DESTINATION ${PROGRAM_PLUGINS_DIR_INFIX})
ELSE (OPENEXR_INCLUDE_DIR AND ILMIMF_LIBRARY)
  MESSAGE(STATUS "Did not find OpenEXR. OpenEXR plugin will not be built")
ENDIF (OPENEXR_INCLUDE_DIR AND ILMIMF_LIBRARY)
