# we need to make sure these come before anything like /usr/incliude so we get the right .mod file
include_directories(BEFORE   ${CMAKE_CURRENT_BINARY_DIR} ${METVIEW_STANDARD_INCLUDES} ${METVIEW_ODB_API_INCLUDE_DIRS})


ecbuild_add_library( TARGET      macro_api_c
                     TYPE        STATIC
                     SOURCES     macro_api.c
                     TEMPLATES   ${common_templates}
                     DEFINITIONS ${METVIEW_EXTRA_DEFINITIONS}
                     LIBS        marsclient ${METVIEW_EXTRA_LIBRARIES}
                    )

if (HAVE_METVIEW_FORTRAN)
ecbuild_add_library( TARGET      macro_api_f90
                     TYPE        STATIC
                     SOURCES     macro_api_f90.f90
                     TEMPLATES   ${common_templates}
                     DEFINITIONS ${METVIEW_EXTRA_DEFINITIONS}
                     LIBS        marsclient ${METVIEW_EXTRA_LIBRARIES}
                    )
endif()


configure_file(macro_api.h ${CMAKE_BINARY_DIR}/include/macro_api.h COPYONLY)

install( FILES ${CMAKE_BINARY_DIR}/include/macro_api.h
         DESTINATION include
         PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)


