From ca4bce61f822dd58460206a73161f68d922064e4 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Mon, 27 Sep 2021 16:54:06 +0300 Subject: [PATCH] GeographicLib --- FindGeographicLib.cmake | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 FindGeographicLib.cmake diff --git a/FindGeographicLib.cmake b/FindGeographicLib.cmake new file mode 100644 index 0000000..58932cc --- /dev/null +++ b/FindGeographicLib.cmake @@ -0,0 +1,40 @@ +# Look for GeographicLib +# +# Set +# GeographicLib_FOUND = GEOGRAPHICLIB_FOUND = TRUE +# GeographicLib_INCLUDE_DIRS = /usr/local/include +# GeographicLib_LIBRARIES = /usr/local/lib/libGeographic.so +# GeographicLib_LIBRARY_DIRS = /usr/local/lib + +find_library (GeographicLib_LIBRARIES Geographic + PATHS "${CMAKE_INSTALL_PREFIX}/../GeographicLib/lib") + +if (GeographicLib_LIBRARIES) + get_filename_component (GeographicLib_LIBRARY_DIRS + "${GeographicLib_LIBRARIES}" PATH) + get_filename_component (_ROOT_DIR "${GeographicLib_LIBRARY_DIRS}" PATH) + set (GeographicLib_INCLUDE_DIRS "${_ROOT_DIR}/include") + set (GeographicLib_BINARY_DIRS "${_ROOT_DIR}/bin") + if (NOT EXISTS "${GeographicLib_INCLUDE_DIRS}/GeographicLib/Config.h") + # On Debian systems the library is in e.g., + # /usr/lib/x86_64-linux-gnu/libGeographic.so + # so try stripping another element off _ROOT_DIR + get_filename_component (_ROOT_DIR "${_ROOT_DIR}" PATH) + set (GeographicLib_INCLUDE_DIRS "${_ROOT_DIR}/include") + set (GeographicLib_BINARY_DIRS "${_ROOT_DIR}/bin") + if (NOT EXISTS "${GeographicLib_INCLUDE_DIRS}/GeographicLib/Config.h") + unset (GeographicLib_INCLUDE_DIRS) + unset (GeographicLib_LIBRARIES) + unset (GeographicLib_LIBRARY_DIRS) + unset (GeographicLib_BINARY_DIRS) + endif () + endif () + unset (_ROOT_DIR) +endif () + +include (FindPackageHandleStandardArgs) +find_package_handle_standard_args (GeographicLib DEFAULT_MSG + GeographicLib_LIBRARY_DIRS GeographicLib_LIBRARIES + GeographicLib_INCLUDE_DIRS) +mark_as_advanced (GeographicLib_LIBRARY_DIRS GeographicLib_LIBRARIES + GeographicLib_INCLUDE_DIRS)