From 480fd8d4da4cda0fb1f14aab7d72d270ea5908a3 Mon Sep 17 00:00:00 2001 From: Kyle Gerheiser Date: Fri, 21 Feb 2020 13:06:53 -0500 Subject: [PATCH 1/2] Use find_package_handle_standard_args in Find Modules --- Modules/Findbacio.cmake | 6 ++++-- Modules/Findbufr.cmake | 3 +++ Modules/Findcrtm.cmake | 3 +++ Modules/Findg2.cmake | 3 +++ Modules/Findg2tmpl.cmake | 3 +++ Modules/Findgfsio.cmake | 3 +++ Modules/Findip.cmake | 3 +++ Modules/Findlandsfcutil.cmake | 3 +++ Modules/Findnemsio.cmake | 6 ++++-- Modules/Findnemsiogfs.cmake | 3 +++ Modules/Findsfcio.cmake | 3 +++ Modules/Findsigio.cmake | 3 +++ Modules/Findsp.cmake | 3 +++ Modules/Findw3emc.cmake | 3 +++ Modules/Findw3nco.cmake | 3 +++ 15 files changed, 47 insertions(+), 4 deletions(-) diff --git a/Modules/Findbacio.cmake b/Modules/Findbacio.cmake index 95eadbf..c31b38c 100644 --- a/Modules/Findbacio.cmake +++ b/Modules/Findbacio.cmake @@ -19,11 +19,13 @@ if(DEFINED ENV{BACIO_LIB4}) if(EXISTS ${${uppercase_name}_LIB${kind}} ) get_filename_component(lib_dir ${${uppercase_name}_LIB${kind}} DIRECTORY) find_library(bacio_path_${kind} NAMES ${versioned_lib_name} PATHS ${lib_dir} NO_DEFAULT_PATH) - add_library(${lib_name} STATIC IMPORTED) set_target_properties(${lib_name} PROPERTIES IMPORTED_LOCATION ${bacio_path_${kind}}) endif() endforeach() - endif() + +find_package_handle_standard_args(bacio + REQUIRED_VARS bacio_path_4) + diff --git a/Modules/Findbufr.cmake b/Modules/Findbufr.cmake index 8d68aaf..25f2126 100644 --- a/Modules/Findbufr.cmake +++ b/Modules/Findbufr.cmake @@ -28,3 +28,6 @@ if(DEFINED ENV{BUFR_LIB4} ) endforeach() endif() + +find_package_handle_standard_args(bufr + REQUIRED_VARS bufr_path_4) diff --git a/Modules/Findcrtm.cmake b/Modules/Findcrtm.cmake index c50c81e..073a618 100644 --- a/Modules/Findcrtm.cmake +++ b/Modules/Findcrtm.cmake @@ -21,3 +21,6 @@ if(DEFINED ENV{CRTM_LIB}) IMPORTED_LOCATION ${crtm_path} INTERFACE_INCLUDE_DIRECTORIES ${${uppercase_name}_INC}) endif() + +find_package_handle_standard_args(crtm + REQUIRED_VARS crtm_path) diff --git a/Modules/Findg2.cmake b/Modules/Findg2.cmake index 2f3f708..1ecffa0 100644 --- a/Modules/Findg2.cmake +++ b/Modules/Findg2.cmake @@ -28,3 +28,6 @@ if(DEFINED ENV{G2_LIBd}) endif() endforeach() endif() + +find_package_handle_standard_args(g2 + REQUIRED_VARS g2_path_d) diff --git a/Modules/Findg2tmpl.cmake b/Modules/Findg2tmpl.cmake index 740bc09..786a84f 100644 --- a/Modules/Findg2tmpl.cmake +++ b/Modules/Findg2tmpl.cmake @@ -26,3 +26,6 @@ if(DEFINED ENV{G2TMPL_LIBd} ) endif() endforeach() endif() + +find_package_handle_standard_args(g2tmpl + REQUIRED_VARS g2tmpl_path_d) diff --git a/Modules/Findgfsio.cmake b/Modules/Findgfsio.cmake index 4cf2cc4..44b221a 100644 --- a/Modules/Findgfsio.cmake +++ b/Modules/Findgfsio.cmake @@ -26,3 +26,6 @@ if(DEFINED ENV{GFSIO_LIB4} ) endif() endforeach() endif() + +find_package_handle_standard_args(gfsio + REQUIRED_VARS gfsio_path_4) diff --git a/Modules/Findip.cmake b/Modules/Findip.cmake index b13e4db..8b20d9a 100644 --- a/Modules/Findip.cmake +++ b/Modules/Findip.cmake @@ -31,3 +31,6 @@ if(DEFINED ENV{IP_LIBd} ) endif() endforeach() endif() + +find_package_handle_standard_args(ip + REQUIRED_VARS ip_path_d) diff --git a/Modules/Findlandsfcutil.cmake b/Modules/Findlandsfcutil.cmake index b479f65..864cd5b 100644 --- a/Modules/Findlandsfcutil.cmake +++ b/Modules/Findlandsfcutil.cmake @@ -32,3 +32,6 @@ if(DEFINED ENV{LANDSFCUTIL_LIB4} ) endif() endforeach() endif() + +find_package_handle_standard_args(landsfcutil + REQUIRED_VARS landsfcutil_path_4) diff --git a/Modules/Findnemsio.cmake b/Modules/Findnemsio.cmake index 37f2755..d1cd13f 100644 --- a/Modules/Findnemsio.cmake +++ b/Modules/Findnemsio.cmake @@ -11,9 +11,8 @@ if(DEFINED ENV{NEMSIO_LIB} ) set(version ${CMAKE_MATCH_1}) set(versioned_lib_name ${name}_${version}) - message("looking for ${${uppercase_name}_LIB}") + if(EXISTS ${${uppercase_name}_LIB} ) - message("found ${${uppercase_name}_LIB}") get_filename_component(lib_dir ${${uppercase_name}_LIB} DIRECTORY) find_library(nemsio_path NAMES ${versioned_lib_name} PATHS ${lib_dir} NO_DEFAULT_PATH) @@ -23,3 +22,6 @@ if(DEFINED ENV{NEMSIO_LIB} ) INTERFACE_INCLUDE_DIRECTORIES ${${uppercase_name}_INC}) endif() endif() + +find_package_handle_standard_args(nemsio + REQUIRED_VARS nemsio_path) diff --git a/Modules/Findnemsiogfs.cmake b/Modules/Findnemsiogfs.cmake index e3f35b0..79d54d5 100644 --- a/Modules/Findnemsiogfs.cmake +++ b/Modules/Findnemsiogfs.cmake @@ -22,3 +22,6 @@ if(DEFINED ENV{NEMSIOGFS_LIB} ) INTERFACE_INCLUDE_DIRECTORIES ${${uppercase_name}_INC}) endif() endif() + +find_package_handle_standard_args(nemsiogfs + REQUIRED_VARS nemsiogfs_path) diff --git a/Modules/Findsfcio.cmake b/Modules/Findsfcio.cmake index 0b88f2a..de08953 100644 --- a/Modules/Findsfcio.cmake +++ b/Modules/Findsfcio.cmake @@ -26,3 +26,6 @@ if(DEFINED ENV{SFCIO_LIB4} ) endif() endforeach() endif() + +find_package_handle_standard_args(sfcio + REQUIRED_VARS sfcio_path) diff --git a/Modules/Findsigio.cmake b/Modules/Findsigio.cmake index 85069d9..44d402b 100644 --- a/Modules/Findsigio.cmake +++ b/Modules/Findsigio.cmake @@ -26,3 +26,6 @@ if(DEFINED ENV{SIGIO_LIB4} ) endif() endforeach() endif() + +find_package_handle_standard_args(sigio + REQUIRED_VARS sigio_path) diff --git a/Modules/Findsp.cmake b/Modules/Findsp.cmake index 79ca7b9..6d3eac2 100644 --- a/Modules/Findsp.cmake +++ b/Modules/Findsp.cmake @@ -27,3 +27,6 @@ if(DEFINED ENV{SP_LIBd}) endif() endforeach() endif() + +find_package_handle_standard_args(sp + REQUIRED_VARS sp_path_d) diff --git a/Modules/Findw3emc.cmake b/Modules/Findw3emc.cmake index 8f0b8b6..ce479ab 100644 --- a/Modules/Findw3emc.cmake +++ b/Modules/Findw3emc.cmake @@ -32,3 +32,6 @@ if(DEFINED ENV{W3EMC_LIBd} ) endif() endforeach() endif() + +find_package_handle_standard_args(w3emc + REQUIRED_VARS w3emc_path_d) diff --git a/Modules/Findw3nco.cmake b/Modules/Findw3nco.cmake index f3c260b..9206063 100644 --- a/Modules/Findw3nco.cmake +++ b/Modules/Findw3nco.cmake @@ -26,3 +26,6 @@ if(DEFINED ENV{W3NCO_LIBd} ) endif() endforeach() endif() + +find_package_handle_standard_args(w3nco + REQUIRED_VARS w3nco_path_d) From 4fbbccb746e2f0ce44c62381915fb3adc98a648b Mon Sep 17 00:00:00 2001 From: Kyle Gerheiser Date: Fri, 21 Feb 2020 15:27:11 -0500 Subject: [PATCH 2/2] Remove _d from g2tmpl --- Modules/Findg2tmpl.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Findg2tmpl.cmake b/Modules/Findg2tmpl.cmake index 786a84f..debb491 100644 --- a/Modules/Findg2tmpl.cmake +++ b/Modules/Findg2tmpl.cmake @@ -28,4 +28,4 @@ if(DEFINED ENV{G2TMPL_LIBd} ) endif() find_package_handle_standard_args(g2tmpl - REQUIRED_VARS g2tmpl_path_d) + REQUIRED_VARS g2tmpl_path)