From 693dee7e8c9f463d75aa83d304a8589ca5edbe81 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 18 Jun 2019 21:28:33 -0400 Subject: [PATCH 1/2] Fix gshhg and dir path if copied --- src/config.h.in | 4 ++-- src/gmt_init.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/config.h.in b/src/config.h.in index 1866b504adf..b719c415bae 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -66,10 +66,10 @@ #define PSL_LIB_NAME "@PSL_LIB_NAME@" /* Name of DCW path */ -#define DCW_INSTALL_PATH "@DCW_PATH@" +#define DCW_INSTALL_PATH "@DCW_INSTALL_PATH@" /* Name of GSHHG path */ -#define GSHHG_INSTALL_PATH "@GSHHG_PATH@" +#define GSHHG_INSTALL_PATH "@GSHHG_INSTALL_PATH@" /* Default units (SI vs US) */ #define GMT_DEF_UNITS "@UNITS@" diff --git a/src/gmt_init.c b/src/gmt_init.c index 46b20867c8c..5ebc6faafda 100644 --- a/src/gmt_init.c +++ b/src/gmt_init.c @@ -5599,11 +5599,13 @@ void gmtinit_conf (struct GMT_CTRL *GMT) { /* DIR_DCW */ if (GMT->session.DCWDIR) gmt_M_str_free (GMT->session.DCWDIR); - GMT->session.DCWDIR = strdup (DCW_INSTALL_PATH); + if (strlen(DCW_INSTALL_PATH)) + GMT->session.DCWDIR = strdup (DCW_INSTALL_PATH); /* DIR_GSHHG */ if (GMT->session.GSHHGDIR) gmt_M_str_free (GMT->session.GSHHGDIR); - GMT->session.GSHHGDIR = strdup (GSHHG_INSTALL_PATH); + if (strlen(GSHHG_INSTALL_PATH)) + GMT->session.GSHHGDIR = strdup (GSHHG_INSTALL_PATH); /* TIME group */ From aaea978f91b21d6d07a9acef84ac5374f5450808 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 18 Jun 2019 21:44:29 -0400 Subject: [PATCH 2/2] Let GSHHG_INSTALL_PATH and DCW_INSTALL_PATH available to upper-level directory --- share/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index 92c525e5f82..6c34946076b 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -34,12 +34,12 @@ if (GSHHG_PATH AND COPY_GSHHG) DESTINATION ${GMT_DATADIR}/coast COMPONENT GSHHG) # location must be blank in gmt.conf - set (GSHHG_INSTALL_PATH) + set (GSHHG_INSTALL_PATH CACHE INTERNAL "Location of GSHHG Data") # create coastline.conf which is needed for in-build-dir ctest configure_file (coastline.conf.in coastline.conf @ONLY) else (GSHHG_PATH AND COPY_GSHHG) # set installed location - set (GSHHG_INSTALL_PATH ${GSHHG_PATH}) + set (GSHHG_INSTALL_PATH ${GSHHG_PATH} CACHE INTERNAL "Location of GSHHG Data") endif (GSHHG_PATH AND COPY_GSHHG) # only attempt to install DCW file when requested and path is known @@ -48,10 +48,10 @@ if (DCW_PATH AND COPY_DCW) DESTINATION ${GMT_DATADIR}/dcw COMPONENT DCW) # location must be blank in gmt.conf - set (DCW_INSTALL_PATH) + set (DCW_INSTALL_PATH CACHE INTERNAL "Location of DCW Data") else (DCW_PATH AND COPY_DCW) # set installed location - set (DCW_INSTALL_PATH ${DCW_PATH}) + set (DCW_INSTALL_PATH ${DCW_PATH} CACHE INTERNAL "Location of GSHHG Data") endif (DCW_PATH AND COPY_DCW)