Fix compatibility with ecbuild 3.1

This commit is contained in:
Willem Deconinck 2019-08-02 10:04:53 +01:00
parent 573bda90ce
commit 43bcf59ac4
3 changed files with 17 additions and 11 deletions

View File

@ -337,8 +337,6 @@ configure_file( eccodes_config.h.in eccodes_config.h )
add_definitions( -DHAVE_ECCODES_CONFIG_H )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/eccodes_config.h DESTINATION ${INSTALL_INCLUDE_DIR} )
if( CMAKE_COMPILER_IS_GNUCC )
ecbuild_add_c_flags("-pedantic")
endif()

View File

@ -44,6 +44,15 @@ if( HAVE_FORTRAN )
SOURCES grib_fortran.c grib_f90.f90 eccodes_f90.f90 grib_kinds.h
GENERATED grib_f90.f90 eccodes_f90.f90
LIBS eccodes )
if( DEFINED ecbuild_VERSION AND NOT ${ecbuild_VERSION} VERSION_LESS 3.1 )
# Installed module directory is not in the PUBLIC INCLUDES!
target_include_directories( eccodes_f90 PUBLIC $<INSTALL_INTERFACE:${INSTALL_INCLUDE_DIR}> )
# NOTE: When eccodes accepts ecbuild 3.0 as minimum requirement,
# this should instead be written inside the ecbuild_add_library macro with:
# PUBLIC_INCLUDES $<INSTALL_INTERFACE:${INSTALL_INCLUDE_DIR}>
endif()
add_custom_command( TARGET eccodes_f90 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_Fortran_MODULE_DIRECTORY}/${CMAKE_CFG_INTDIR}/eccodes.mod ${CMAKE_BINARY_DIR}/include

View File

@ -434,14 +434,13 @@ endif()
ecbuild_add_library(TARGET eccodes
SOURCES grib_api_version.c
# griby.c gribl.c
${grib_api_srcs}
${grib_api_srcs}
GENERATED grib_api_version.c
LIBS ${ECCODES_EXTRA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CMATH_LIBRARIES}
TEMPLATES ${grib_api_extra_srcs})
install( FILES grib_api.h eccodes.h eccodes_windef.h DESTINATION ${INSTALL_INCLUDE_DIR} )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/eccodes_version.h DESTINATION ${INSTALL_INCLUDE_DIR} )
TEMPLATES ${grib_api_extra_srcs}
INSTALL_HEADERS_LIST
grib_api.h
eccodes.h
eccodes_windef.h
${CMAKE_CURRENT_BINARY_DIR}/eccodes_version.h
${PROJECT_BINARY_DIR}/eccodes_config.h )