From 1a2dcf517cfa66c72ccd4269f2d1ab373109e23e Mon Sep 17 00:00:00 2001 From: Olivier Iffrig Date: Tue, 30 Apr 2019 13:51:00 +0100 Subject: [PATCH] Make the definitions and samples paths relocatable --- eccodes-import.cmake.in | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/eccodes-import.cmake.in b/eccodes-import.cmake.in index 9a6f7833e..62c20ffb6 100644 --- a/eccodes-import.cmake.in +++ b/eccodes-import.cmake.in @@ -3,7 +3,10 @@ if( @PNAME@_IS_BUILD_DIR_EXPORT ) 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@ ) + if( NOT DEFINED eccodes_BASE_DIR ) # ecbuild 2.x + get_filename_component( eccodes_BASE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE ) + endif() + set( ECCODES_DEFINITION_PATH ${eccodes_BASE_DIR}/@ECCODES_DEFINITION_SUFF@ ) + set( ECCODES_SAMPLES_PATH ${eccodes_BASE_DIR}/@ECCODES_SAMPLES_SUFF@ ) + set( ECCODES_IFS_SAMPLES_PATH ${eccodes_BASE_DIR}/@ECCODES_IFS_SAMPLES_SUFF@ ) endif()