GRIB-822 Export samples and definition paths for install and build trees

With ECBUILD-105 is is possible to check for build vs. install tree
export in <package>-import.cmake scripts.
Use this to export the correct GRIB_API_DEFINITION_PATH,
GRIB_API_SAMPLES_PATH, GRIB_API_IFS_SAMPLES_PATH in
grib_api-import.cmake for dependent projects to use.
This commit is contained in:
Shahram Najm 2015-08-28 14:00:17 +01:00
parent 53de0863c4
commit 6a626a235d
3 changed files with 25 additions and 15 deletions

View File

@ -186,19 +186,23 @@ endif()
# contents # contents
if( NOT ${DEVELOPER_MODE} ) if( NOT ${DEVELOPER_MODE} )
set( grib_api_default_data_prefix ${CMAKE_INSTALL_PREFIX} ) set( the_default_data_prefix ${CMAKE_INSTALL_PREFIX} )
else() else()
set( grib_api_default_data_prefix ${CMAKE_BINARY_DIR} ) set( the_default_data_prefix ${CMAKE_BINARY_DIR} )
endif() endif()
set( ECCODES_DEFINITION_SUFF share/eccodes/definitions )
set( ECCODES_SAMPLES_SUFF share/eccodes/samples )
set( ECCODES_IFS_SAMPLES_SUFF share/eccodes/ifs_samples )
if( NOT DEFINED ECCODES_DEFINITION_PATH ) if( NOT DEFINED ECCODES_DEFINITION_PATH )
set( ECCODES_DEFINITION_PATH ${grib_api_default_data_prefix}/share/eccodes/definitions ) set( ECCODES_DEFINITION_PATH ${the_default_data_prefix}/${ECCODES_DEFINITION_SUFF} )
endif() endif()
if( NOT DEFINED ECCODES_SAMPLES_PATH ) if( NOT DEFINED ECCODES_SAMPLES_PATH )
set( ECCODES_SAMPLES_PATH ${grib_api_default_data_prefix}/share/eccodes/samples ) set( ECCODES_SAMPLES_PATH ${the_default_data_prefix}/${ECCODES_SAMPLES_SUFF} )
endif() endif()
if( NOT DEFINED ECCODES_IFS_SAMPLES_PATH ) if( NOT DEFINED ECCODES_IFS_SAMPLES_PATH )
set( ECCODES_IFS_SAMPLES_PATH ${grib_api_default_data_prefix}/share/eccodes/ifs_samples ) set( ECCODES_IFS_SAMPLES_PATH ${the_default_data_prefix}/${ECCODES_IFS_SAMPLES_SUFF} )
endif() endif()
### config header ### config header

9
eccodes-import.cmake.in Normal file
View File

@ -0,0 +1,9 @@
if( @PNAME@_IS_BUILD_DIR_EXPORT )
set( ECCODES_DEFINITION_PATH @CMAKE_BINARY_DIR@/@ECCODES_DEFINITION_SUFF@ )
set( ECCODES_SAMPLES_PATH @CMAKE_BINARY_DIR@/@ECCODES_SAMPLES_SUFF@ )
set( ECCODES_IFS_SAMPLES_PATH @CMAKE_BINARY_DIR@/@ECCODES_IFS_SAMPLES_SUFF@ )
else()
set( ECCODES_DEFINITION_PATH @CMAKE_INSTALL_PREFIX@/@ECCODES_DEFINITION_SUFF@ )
set( ECCODES_SAMPLES_PATH @CMAKE_INSTALL_PREFIX@/@ECCODES_SAMPLES_SUFF@ )
set( ECCODES_IFS_SAMPLES_PATH @CMAKE_INSTALL_PREFIX@/@ECCODES_IFS_SAMPLES_SUFF@ )
endif()

View File

@ -1,3 +0,0 @@
set( ECCODES_SAMPLES_PATH "@ECCODES_SAMPLES_PATH@" )
set( ECCODES_IFS_SAMPLES_PATH "@ECCODES_IFS_SAMPLES_PATH@" )
set( ECCODES_DEFINITION_PATH "@ECCODES_DEFINITION_PATH@" )