From ad93825ffe5eb8e2cfd86d0a4aa77030fdec4255 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Tue, 18 Aug 2020 11:14:29 +0100 Subject: [PATCH] Support for ecbuild v3.4. Version macros and PRIVATE_LIB --- CMakeLists.txt | 19 ++++++++----------- eccodes_config.h.in | 8 ++++---- fortran/CMakeLists.txt | 2 +- src/CMakeLists.txt | 2 +- src/eccodes_version.h.in | 8 ++++---- tools/CMakeLists.txt | 2 +- 6 files changed, 19 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 11e092b43..e6d08a7c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,11 +99,10 @@ ecbuild_add_option( FEATURE JPG_LIBOPENJPEG CONDITION ENABLE_JPG DEFAULT ON ) -find_package( PNG ) ecbuild_add_option( FEATURE PNG DESCRIPTION "Support for PNG decoding/encoding" DEFAULT OFF - CONDITION PNG_FOUND ) + REQUIRED_PACKAGES PNG ) if( HAVE_PNG ) set( HAVE_LIBPNG 1 ) # compatibility with autotools @@ -112,20 +111,18 @@ else() set( HAVE_LIBPNG 0 ) endif() -find_package( NetCDF ) ecbuild_add_option( FEATURE NETCDF DESCRIPTION "Support for GRIB to NetCDF conversion" DEFAULT ON - CONDITION NetCDF_FOUND + REQUIRED_PACKAGES NetCDF NO_TPL ) -find_package( AEC QUIET ) +find_package( AEC ) ecbuild_add_option( FEATURE AEC DESCRIPTION "Support for Adaptive Entropy Coding" DEFAULT OFF CONDITION AEC_FOUND ) -#find_package( Python 2.6 NO_LIBS ) ecbuild_find_python( VERSION 2.6 NO_LIBS ) find_package( NumPy ) message(STATUS "..............Python_FOUND=${PYTHON_FOUND} and NumPy_FOUND=${NUMPY_FOUND}") @@ -218,11 +215,11 @@ if( ENABLE_JPG ) # which can affect future package discovery if not undone by the caller. # The current CMAKE_PREFIX_PATH is backed up as _CMAKE_PREFIX_PATH # - set(CMAKE_WARN_DEPRECATED OFF) # Suppress deprecation message - ecbuild_add_extra_search_paths( jasper ) + #set(CMAKE_WARN_DEPRECATED OFF) # Suppress deprecation message + #ecbuild_add_extra_search_paths( jasper ) find_package( Jasper ) - set(CMAKE_PREFIX_PATH ${_CMAKE_PREFIX_PATH}) # Restore CMAKE_PREFIX_PATH - set(CMAKE_WARN_DEPRECATED ON) # Remove suppression + #set(CMAKE_PREFIX_PATH ${_CMAKE_PREFIX_PATH}) # Restore CMAKE_PREFIX_PATH + #set(CMAKE_WARN_DEPRECATED ON) # Remove suppression find_package( OpenJPEG ) @@ -507,7 +504,7 @@ ecbuild_print_summary() ecbuild_info("") ecbuild_info(" +--------------------------+") -ecbuild_info(" | ecCodes version ${ECCODES_VERSION} |") +ecbuild_info(" | ecCodes version ${eccodes_VERSION} |") ecbuild_info(" +--------------------------+") ecbuild_info("") diff --git a/eccodes_config.h.in b/eccodes_config.h.in index 6c00bc7bb..534c9bf23 100644 --- a/eccodes_config.h.in +++ b/eccodes_config.h.in @@ -13,13 +13,13 @@ #include "eccodes_ecbuild_config.h" /* generated by ecbuild */ -#define ECCODES_VERSION_STR "@ECCODES_VERSION_STR@" +#define ECCODES_VERSION_STR "@eccodes_VERSION_STR@" /* ECCODES_VERSION is defined in eccodes_version.h from the 3 version components below */ -#define ECCODES_MAJOR_VERSION @ECCODES_MAJOR_VERSION@ -#define ECCODES_MINOR_VERSION @ECCODES_MINOR_VERSION@ -#define ECCODES_REVISION_VERSION @ECCODES_PATCH_VERSION@ +#define ECCODES_MAJOR_VERSION @eccodes_VERSION_MAJOR@ +#define ECCODES_MINOR_VERSION @eccodes_VERSION_MINOR@ +#define ECCODES_REVISION_VERSION @eccodes_VERSION_PATCH@ #define ECCODES_DEFINITION_PATH "@ECCODES_DEFINITION_PATH@" diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt index cfd9e7607..6ae04a24b 100644 --- a/fortran/CMakeLists.txt +++ b/fortran/CMakeLists.txt @@ -45,7 +45,7 @@ if( HAVE_FORTRAN ) ecbuild_add_library( TARGET eccodes_f90 SOURCES grib_fortran.c grib_f90.f90 eccodes_f90.f90 grib_kinds.h GENERATED grib_f90.f90 eccodes_f90.f90 - LIBS eccodes ) + PRIVATE_LIBS eccodes ) if( DEFINED ecbuild_VERSION AND NOT ${ecbuild_VERSION} VERSION_LESS 3.1 ) # Installed module directory is not in the PUBLIC INCLUDES! target_include_directories( eccodes_f90 PUBLIC $ ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6ffefeef8..431ed3945 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -440,7 +440,7 @@ ecbuild_add_library( TARGET eccodes # griby.c gribl.c ${grib_api_srcs} GENERATED grib_api_version.c - LIBS ${ECCODES_EXTRA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CMATH_LIBRARIES} + PRIVATE_LIBS ${ECCODES_EXTRA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CMATH_LIBRARIES} TEMPLATES ${grib_api_extra_srcs} INSTALL_HEADERS_LIST grib_api.h diff --git a/src/eccodes_version.h.in b/src/eccodes_version.h.in index 27fb37ec4..08eec18ec 100644 --- a/src/eccodes_version.h.in +++ b/src/eccodes_version.h.in @@ -11,11 +11,11 @@ #ifndef eccodes_version_H #define eccodes_version_H -#define ECCODES_VERSION_STR "@ECCODES_VERSION_STR@" +#define ECCODES_VERSION_STR "@eccodes_VERSION_STR@" -#define ECCODES_MAJOR_VERSION @ECCODES_MAJOR_VERSION@ -#define ECCODES_MINOR_VERSION @ECCODES_MINOR_VERSION@ -#define ECCODES_REVISION_VERSION @ECCODES_PATCH_VERSION@ +#define ECCODES_MAJOR_VERSION @eccodes_VERSION_MAJOR@ +#define ECCODES_MINOR_VERSION @eccodes_VERSION_MINOR@ +#define ECCODES_REVISION_VERSION @eccodes_VERSION_PATCH@ #define ECCODES_VERSION (ECCODES_MAJOR_VERSION*10000+ECCODES_MINOR_VERSION*100+ECCODES_REVISION_VERSION) #endif /* eccodes_version_H */ diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 634cbf8bf..20e87e98c 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -23,7 +23,7 @@ ecbuild_add_library( TARGET grib_tools TYPE STATIC NOINSTALL SOURCES ${grib_tools_sources} - LIBS eccodes ) + PRIVATE_LIBS eccodes ) # tools binaries list( APPEND ecc_tools_binaries