diff --git a/CMakeLists.txt b/CMakeLists.txt index b5403393d..0ad88ba0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,6 +181,9 @@ endif() if( NOT DEFINED GRIB_API_SAMPLES_PATH ) set( GRIB_API_SAMPLES_PATH ${grib_api_default_data_prefix}/share/grib_api/samples ) endif() +if( NOT DEFINED GRIB_API_IFS_SAMPLES_PATH ) + set( GRIB_API_IFS_SAMPLES_PATH ${grib_api_default_data_prefix}/share/grib_api/ifs_samples ) +endif() ### config header @@ -250,11 +253,19 @@ add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source) # temporary -- add support for ecbuild 1.0.x sub-project inclusion # to remove once mars server & client use eckit & ecbuild >= 1.1 +if( EC_HAVE_FORTRAN ) + list( APPEND GRIB_API_INCLUDE_DIRS ${CMAKE_Fortran_MODULE_DIRECTORY} ) + list( APPEND GRIB_API_LIBRARIES grib_api_f77 grib_api_f90 ) +endif() + if( NOT ${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME} ) set( GRIB_API_DEFINITIONS ${GRIB_API_DEFINITIONS} PARENT_SCOPE )# includes already TPL definitions set( GRIB_API_INCLUDE_DIRS ${GRIB_API_INCLUDE_DIRS} ${GRIB_API_EXTRA_INCLUDE_DIRS} PARENT_SCOPE ) set( GRIB_API_LIBRARIES ${GRIB_API_LIBRARIES} ${GRIB_API_EXTRA_LIBRARIES} ${CMATH_LIBRARIES} PARENT_SCOPE ) set( GRIB_API_FOUND TRUE PARENT_SCOPE ) + set( GRIB_API_SAMPLES_PATH ${GRIB_API_SAMPLES_PATH} PARENT_SCOPE ) + set( GRIB_API_IFS_SAMPLES_PATH ${GRIB_API_IFS_SAMPLES_PATH} PARENT_SCOPE ) + set( GRIB_API_DEFINITION_PATH ${GRIB_API_DEFINITION_PATH} PARENT_SCOPE ) endif() ############################################################################################ diff --git a/grib_api-import.cmake.in b/grib_api-import.cmake.in new file mode 100644 index 000000000..deb4c22fb --- /dev/null +++ b/grib_api-import.cmake.in @@ -0,0 +1,3 @@ +set( GRIB_API_SAMPLES_PATH "@GRIB_API_SAMPLES_PATH@" ) +set( GRIB_API_IFS_SAMPLES_PATH "@GRIB_API_IFS_SAMPLES_PATH@" ) +set( GRIB_API_DEFINITION_PATH "@GRIB_API_DEFINITION_PATH@" ) diff --git a/ifs_samples/grib1/CMakeLists.txt b/ifs_samples/grib1/CMakeLists.txt index 052162bd7..4c3fcfad1 100644 --- a/ifs_samples/grib1/CMakeLists.txt +++ b/ifs_samples/grib1/CMakeLists.txt @@ -8,5 +8,8 @@ list( APPEND ifs_samples_${_basedir} ) install( FILES ${GRIB_API_SAMPLES_FILES} ${ifs_samples_${_basedir}} - DESTINATION share/${PROJECT_NAME}/ifs_samples/${_basedir} + DESTINATION ${GRIB_API_IFS_SAMPLES_PATH}/${_basedir} PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ ) + +file( COPY ${ifs_samples_${_basedir}} + DESTINATION ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/ifs_samples/${_basedir} ) diff --git a/ifs_samples/grib1_mlgrib2/CMakeLists.txt b/ifs_samples/grib1_mlgrib2/CMakeLists.txt index 86f6cefc8..253c7be1b 100644 --- a/ifs_samples/grib1_mlgrib2/CMakeLists.txt +++ b/ifs_samples/grib1_mlgrib2/CMakeLists.txt @@ -8,5 +8,8 @@ list( APPEND ifs_samples_${_basedir} ) install( FILES ${GRIB_API_SAMPLES_FILES} ${ifs_samples_${_basedir}} - DESTINATION share/${PROJECT_NAME}/ifs_samples/${_basedir} + DESTINATION ${GRIB_API_IFS_SAMPLES_PATH}/${_basedir} PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ ) + +file( COPY ${ifs_samples_${_basedir}} + DESTINATION ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/ifs_samples/${_basedir} ) diff --git a/ifs_samples/grib1_mlgrib2_ieee32/CMakeLists.txt b/ifs_samples/grib1_mlgrib2_ieee32/CMakeLists.txt index ee10cc492..210eeda3e 100644 --- a/ifs_samples/grib1_mlgrib2_ieee32/CMakeLists.txt +++ b/ifs_samples/grib1_mlgrib2_ieee32/CMakeLists.txt @@ -8,5 +8,8 @@ list( APPEND ifs_samples_${_basedir} ) install( FILES ${GRIB_API_SAMPLES_FILES} ${ifs_samples_${_basedir}} - DESTINATION share/${PROJECT_NAME}/ifs_samples/${_basedir} + DESTINATION ${GRIB_API_IFS_SAMPLES_PATH}/${_basedir} PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ ) + +file( COPY ${ifs_samples_${_basedir}} + DESTINATION ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/ifs_samples/${_basedir} ) diff --git a/ifs_samples/grib1_mlgrib2_ieee64/CMakeLists.txt b/ifs_samples/grib1_mlgrib2_ieee64/CMakeLists.txt index 975f5d5dd..a8b752fea 100644 --- a/ifs_samples/grib1_mlgrib2_ieee64/CMakeLists.txt +++ b/ifs_samples/grib1_mlgrib2_ieee64/CMakeLists.txt @@ -8,5 +8,8 @@ list( APPEND ifs_samples_${_basedir} ) install( FILES ${GRIB_API_SAMPLES_FILES} ${ifs_samples_${_basedir}} - DESTINATION share/${PROJECT_NAME}/ifs_samples/${_basedir} + DESTINATION ${GRIB_API_IFS_SAMPLES_PATH}/${_basedir} PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ ) + +file( COPY ${ifs_samples_${_basedir}} + DESTINATION ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/ifs_samples/${_basedir} )