Warning, /education/kstars/cmake/modules/FindERFA.cmake is written in an unsupported language. File is not indexed.

0001 # SPDX-FileCopyrightText: 2021 Heiko Becker <heiko.becker@kde.org>
0002 #
0003 # SPDX-License-Identifier: BSD-3-Clause
0004 
0005 #[=======================================================================[.rst:
0006 FindERFA
0007 ----------
0008 
0009 Try to find the ERFA (Essential Routines for Fundamental Astronomy) library.
0010 
0011 This will define the following variables:
0012 
0013 ``ERFA_FOUND``
0014       True if the system has the ERFA library of at least the minimum
0015       version specified by the version parameter to find_package()
0016 ``ERFA_INCLUDE_DIRS``
0017       The ERFA include dirs for use with target_include_directories
0018 ``ERFA_LIBRARIES``
0019       The ERFA libraries for use with target_link_libraries()
0020 ``ERFA_VERSION``
0021       The version of ERFA that was found
0022 
0023 If ``ERFA_FOUND` is TRUE, it will also define the following imported
0024 target:
0025 
0026 ``ERFA::ERFA``
0027       The ERFA library
0028 
0029 #]=======================================================================]
0030 
0031 find_package(PkgConfig QUIET)
0032 
0033 pkg_check_modules(PC_ERFA QUIET erfa)
0034 
0035 find_path(ERFA_INCLUDE_DIRS
0036     NAMES erfa.h
0037     HINTS ${PC_ERFA_INCLUDEDIR}
0038 )
0039 
0040 find_library(ERFA_LIBRARIES
0041     NAMES erfa
0042     HINTS ${PC_ERFA_LIBDIR}
0043 )
0044 
0045 set(ERFA_VERSION ${PC_ERFA_VERSION})
0046 
0047 include(FindPackageHandleStandardArgs)
0048 find_package_handle_standard_args(ERFA
0049     FOUND_VAR
0050         ERFA_FOUND
0051     REQUIRED_VARS
0052         ERFA_LIBRARIES
0053         ERFA_INCLUDE_DIRS
0054     VERSION_VAR
0055         ERFA_VERSION
0056 )
0057 
0058 if (ERFA_FOUND AND NOT TARGET ERFA::ERFA)
0059     add_library(ERFA::ERFA UNKNOWN IMPORTED)
0060     set_target_properties(ERFA::ERFA PROPERTIES
0061         IMPORTED_LOCATION "${ERFA_LIBRARIES}"
0062         INTERFACE_INCLUDE_DIRECTORIES "${ERFA_INCLUDE_DIRS}"
0063     )
0064 endif()
0065 
0066 mark_as_advanced(ERFA_LIBRARIES ERFA_INCLUDE_DIRS)
0067 
0068 include(FeatureSummary)
0069 set_package_properties(ERFA PROPERTIES
0070     URL "https://github.com/liberfa/erfa/"
0071     DESCRIPTION "Essential Routines for Fundamental Astronomy"
0072 )