From 76530a0cbf26078b875b06c6c0324b00c1137803 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Tue, 22 Sep 2015 11:42:54 +0100 Subject: [PATCH] GRIB-822: Make definitions/samples suffixes overridable, but not paths, Place ifs_samples in build and install root by default --- CMakeLists.txt | 40 +++++++++---------- ifs_samples/grib1/CMakeLists.txt | 4 +- ifs_samples/grib1_mlgrib2/CMakeLists.txt | 4 +- .../grib1_mlgrib2_ieee64/CMakeLists.txt | 4 +- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 38ef4af9d..46c16a297 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,19 +194,19 @@ else() set( the_default_data_prefix ${CMAKE_BINARY_DIR} ) 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_SUFF ) + set( ECCODES_DEFINITION_SUFF share/eccodes/definitions ) +endif() +if( NOT DEFINED ECCODES_SAMPLES_SUFF ) + set( ECCODES_SAMPLES_SUFF share/eccodes/samples ) +endif() +if( NOT DEFINED ECCODES_IFS_SAMPLES_SUFF ) + set( ECCODES_IFS_SAMPLES_SUFF ifs_samples ) +endif() -if( NOT DEFINED ECCODES_DEFINITION_PATH ) - set( ECCODES_DEFINITION_PATH ${the_default_data_prefix}/${ECCODES_DEFINITION_SUFF} ) -endif() -if( NOT DEFINED ECCODES_SAMPLES_PATH ) - set( ECCODES_SAMPLES_PATH ${the_default_data_prefix}/${ECCODES_SAMPLES_SUFF} ) -endif() -if( NOT DEFINED ECCODES_IFS_SAMPLES_PATH ) - set( ECCODES_IFS_SAMPLES_PATH ${the_default_data_prefix}/${ECCODES_IFS_SAMPLES_SUFF} ) -endif() +set( ECCODES_DEFINITION_PATH ${the_default_data_prefix}/${ECCODES_DEFINITION_SUFF} ) +set( ECCODES_SAMPLES_PATH ${the_default_data_prefix}/${ECCODES_SAMPLES_SUFF} ) +set( ECCODES_IFS_SAMPLES_PATH ${the_default_data_prefix}/${ECCODES_IFS_SAMPLES_SUFF} ) ### config header @@ -282,14 +282,14 @@ if( EC_HAVE_FORTRAN ) endif() if( NOT PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME ) - set( ECCODES_DEFINITIONS ${ECCODES_DEFINITIONS} PARENT_SCOPE )# includes already TPL definitions - set( ECCODES_INCLUDE_DIRS ${ECCODES_INCLUDE_DIRS} ${ECCODES_EXTRA_INCLUDE_DIRS} PARENT_SCOPE ) - set( ECCODES_LIBRARIES ${ECCODES_LIBRARIES} ${ECCODES_EXTRA_LIBRARIES} ${CMATH_LIBRARIES} PARENT_SCOPE ) - set( ECCODES_FOUND TRUE PARENT_SCOPE ) - set( ECCODES_SAMPLES_PATH ${ECCODES_SAMPLES_PATH} PARENT_SCOPE ) - set( ECCODES_IFS_SAMPLES_PATH ${ECCODES_IFS_SAMPLES_PATH} PARENT_SCOPE ) - set( ECCODES_DEFINITION_PATH ${ECCODES_DEFINITION_PATH} PARENT_SCOPE ) - set( ECCODES_INSTALL_ECMWF_TOOLS ${ECCODES_INSTALL_ECMWF_TOOLS} PARENT_SCOPE ) + set( ECCODES_FOUND TRUE PARENT_SCOPE ) + set( ECCODES_DEFINITIONS ${ECCODES_DEFINITIONS} PARENT_SCOPE )# includes already TPL definitions + set( ECCODES_INCLUDE_DIRS ${ECCODES_INCLUDE_DIRS} ${ECCODES_EXTRA_INCLUDE_DIRS} PARENT_SCOPE ) + set( ECCODES_LIBRARIES ${ECCODES_LIBRARIES} ${ECCODES_EXTRA_LIBRARIES} ${CMATH_LIBRARIES} PARENT_SCOPE ) + set( ECCODES_SAMPLES_PATH ${ECCODES_SAMPLES_PATH} PARENT_SCOPE ) + set( ECCODES_IFS_SAMPLES_PATH ${ECCODES_IFS_SAMPLES_PATH} PARENT_SCOPE ) + set( ECCODES_DEFINITION_PATH ${ECCODES_DEFINITION_PATH} PARENT_SCOPE ) + set( ECCODES_INSTALL_ECMWF_TOOLS ${ECCODES_INSTALL_ECMWF_TOOLS} PARENT_SCOPE ) endif() # pkg-config diff --git a/ifs_samples/grib1/CMakeLists.txt b/ifs_samples/grib1/CMakeLists.txt index 484e3e4d4..b8de44d61 100644 --- a/ifs_samples/grib1/CMakeLists.txt +++ b/ifs_samples/grib1/CMakeLists.txt @@ -8,8 +8,8 @@ list( APPEND ifs_samples_${_basedir} ) install( FILES ${ECCODES_SAMPLES_FILES} ${ifs_samples_${_basedir}} - DESTINATION ${ECCODES_IFS_SAMPLES_PATH}/${_basedir} + DESTINATION ${CMAKE_INSTALL_PREFIX}/${ECCODES_IFS_SAMPLES_SUFF}/${_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} ) + DESTINATION ${CMAKE_BINARY_DIR}/${ECCODES_IFS_SAMPLES_SUFF}/${_basedir} ) diff --git a/ifs_samples/grib1_mlgrib2/CMakeLists.txt b/ifs_samples/grib1_mlgrib2/CMakeLists.txt index e4e4908f5..8f250df15 100644 --- a/ifs_samples/grib1_mlgrib2/CMakeLists.txt +++ b/ifs_samples/grib1_mlgrib2/CMakeLists.txt @@ -8,8 +8,8 @@ list( APPEND ifs_samples_${_basedir} ) install( FILES ${ECCODES_SAMPLES_FILES} ${ifs_samples_${_basedir}} - DESTINATION ${ECCODES_IFS_SAMPLES_PATH}/${_basedir} + DESTINATION ${CMAKE_INSTALL_PREFIX}/${ECCODES_IFS_SAMPLES_SUFF}/${_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} ) + DESTINATION ${CMAKE_BINARY_DIR}/${ECCODES_IFS_SAMPLES_SUFF}/${_basedir} ) diff --git a/ifs_samples/grib1_mlgrib2_ieee64/CMakeLists.txt b/ifs_samples/grib1_mlgrib2_ieee64/CMakeLists.txt index 4d7974a36..df8ec7382 100644 --- a/ifs_samples/grib1_mlgrib2_ieee64/CMakeLists.txt +++ b/ifs_samples/grib1_mlgrib2_ieee64/CMakeLists.txt @@ -8,8 +8,8 @@ list( APPEND ifs_samples_${_basedir} ) install( FILES ${ECCODES_SAMPLES_FILES} ${ifs_samples_${_basedir}} - DESTINATION ${ECCODES_IFS_SAMPLES_PATH}/${_basedir} + DESTINATION ${CMAKE_INSTALL_PREFIX}/${ECCODES_IFS_SAMPLES_SUFF}/${_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} ) + DESTINATION ${CMAKE_BINARY_DIR}/${ECCODES_IFS_SAMPLES_SUFF}/${_basedir} )