
if(METVIEW_QT5)
 QT5_WRAP_CPP(savepool_MOC savepool.h)
else()
 QT4_WRAP_CPP(savepool_MOC savepool.h)
endif()

ecbuild_add_executable( TARGET       savepool 
                        SOURCES      savepool.cc ${savepool_MOC}
                        DEFINITIONS  ${METVIEW_EXTRA_DEFINITIONS}
                        INCLUDES     ${METVIEW_STANDARD_INCLUDES} ${METVIEW_QT_INCLUDE_DIRS}
                        LIBS         ${METVIEW_QT_LIBRARIES} ${STANDARD_METVIEW_LIBS} ${FDB_LIBRARIES}
                    )
######## xxxxx ODB????



ecbuild_add_executable( TARGET       MvMailTo
                        SOURCES      MvMailTo.cc
                        DEFINITIONS  ${METVIEW_EXTRA_DEFINITIONS}
                        INCLUDES     ${METVIEW_STANDARD_INCLUDES} ${METVIEW_QT_INCLUDE_DIRS}
                        LIBS         ${METVIEW_QT_LIBRARIES} ${STANDARD_METVIEW_LIBS}
                    )


ecbuild_add_executable( TARGET       MvCompress
                        SOURCES      MvCompress.cc
                        DEFINITIONS  ${METVIEW_EXTRA_DEFINITIONS}
                        INCLUDES     ${METVIEW_STANDARD_INCLUDES}
                        LIBS         ${STANDARD_METVIEW_LIBS}
                    )

if(ENABLE_MOTIF)

ecbuild_add_executable( TARGET       exampool
                        SOURCES      examcback.cc exammain.c examwidgets.h
                        DEFINITIONS  ${METVIEW_EXTRA_DEFINITIONS}
                        INCLUDES     ${X11_INCLUDE_DIR} ${METVIEW_STANDARD_INCLUDES} ${METVIEW_MOTIF_INCLUDE_DIR}
                        LIBS         ${METVIEW_MOTIF_LIBS} ${STANDARD_METVIEW_LIBS} ${METVIEW_EXTRA_LIBRARIES} ${MOTIF_LIBRARIES} ${X11_LIBRARIES}
                    )


ADD_CUSTOM_COMMAND(
    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/maill.c
	COMMAND lex -l ${CMAKE_CURRENT_SOURCE_DIR}/maill.l\; sed -e s/yy/mail/g < lex.yy.c > ${CMAKE_CURRENT_BINARY_DIR}/maill.c
    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/maill.l)

ADD_CUSTOM_TARGET(maillex DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/maill.c)

ecbuild_add_executable( TARGET       mvnews
                        SOURCES      newsmain.c newscback.c maill.c
                        DEFINITIONS  ${METVIEW_EXTRA_DEFINITIONS}
                        INCLUDES     ${X11_INCLUDE_DIR} ${METVIEW_STANDARD_INCLUDES} ${METVIEW_MOTIF_INCLUDE_DIR}
                        LIBS         ${METVIEW_MOTIF_LIBS} ${STANDARD_METVIEW_LIBS} ${METVIEW_EXTRA_LIBRARIES} ${MOTIF_LIBRARIES} ${X11_LIBRARIES}
                    )
ADD_DEPENDENCIES(mvnews maillex)


ecbuild_add_executable( TARGET       mvmail
                        SOURCES      mailmain.c mailcback.c
                        DEFINITIONS  ${METVIEW_EXTRA_DEFINITIONS}
                        INCLUDES     ${X11_INCLUDE_DIR} ${METVIEW_STANDARD_INCLUDES} ${METVIEW_MOTIF_INCLUDE_DIR}
                        LIBS         ${METVIEW_MOTIF_LIBS} ${STANDARD_METVIEW_LIBS} ${METVIEW_EXTRA_LIBRARIES} ${MOTIF_LIBRARIES} ${X11_LIBRARIES}
                    )

ecbuild_add_executable( TARGET       checkdisplay
                        SOURCES      checkdisplay.cc
                        DEFINITIONS  ${METVIEW_EXTRA_DEFINITIONS}
                        INCLUDES     ${X11_INCLUDE_DIR} ${METVIEW_STANDARD_INCLUDES} ${METVIEW_MOTIF_INCLUDE_DIR}
                        LIBS         ${METVIEW_MOTIF_LIBS} ${STANDARD_METVIEW_LIBS} ${METVIEW_EXTRA_LIBRARIES} ${MOTIF_LIBRARIES} ${X11_LIBRARIES}
                    )

endif()
