|
| 1 | +# - Try to find libopenvlbi |
| 2 | +# Once done this will define |
| 3 | +# |
| 4 | +# VLBI_FOUND - system has libopenvlbi |
| 5 | +# VLBI_INCLUDE_DIRS - the libopenvlbi include directories |
| 6 | +# VLBI_LIBRARIES - Link these to use libopenvlbi |
| 7 | +# VLBI_DEFINITIONS - Compiler switches required for using libopenvlbi |
| 8 | +# |
| 9 | +# VLBI_HAS_VLBI_VERSION - defined when libopenvlbi has vlbi_get_version() |
| 10 | + |
| 11 | +#============================================================================= |
| 12 | +# Copyright (c) 2022 Ilia Platone <info@iliaplatone.com> |
| 13 | +# |
| 14 | +# Redistribution and use in source and binary forms, with or without |
| 15 | +# modification, are permitted provided that the following conditions |
| 16 | +# are met: |
| 17 | +# |
| 18 | +# 1. Redistributions of source code must retain the copyright |
| 19 | +# notice, this list of conditions and the following disclaimer. |
| 20 | +# 2. Redistributions in binary form must reproduce the copyright |
| 21 | +# notice, this list of conditions and the following disclaimer in the |
| 22 | +# documentation and/or other materials provided with the distribution. |
| 23 | +# 3. The name of the author may not be used to endorse or promote products |
| 24 | +# derived from this software without specific prior written permission. |
| 25 | +# |
| 26 | +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 27 | +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 28 | +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 29 | +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 30 | +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 31 | +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 32 | +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 33 | +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 34 | +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 35 | +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 36 | +#============================================================================= |
| 37 | + |
| 38 | +find_path(VLBI_INCLUDE_DIRS |
| 39 | + NAMES |
| 40 | + vlbi.h |
| 41 | + HINTS |
| 42 | + ${VLBI_INCLUDE_DIRS} |
| 43 | + PATH_SUFFIXES |
| 44 | + OpenVLBI |
| 45 | +) |
| 46 | + |
| 47 | +find_library(VLBI_LIBRARIES |
| 48 | + NAMES |
| 49 | + openvlbi |
| 50 | + HINTS |
| 51 | + ${VLBI_LIBRARY_DIRS} |
| 52 | +) |
| 53 | + |
| 54 | +set(VLBI_INCLUDE_DIRS ${VLBI_INCLUDE_DIR}) |
| 55 | +set(VLBI_LIBRARIES ${VLBI_LIBRARY}) |
| 56 | + |
| 57 | +include(FindPackageHandleStandardArgs) |
| 58 | +find_package_handle_standard_args(VLBI |
| 59 | + FOUND_VAR |
| 60 | + VLBI_FOUND |
| 61 | + REQUIRED_VARS |
| 62 | + VLBI_LIBRARIES |
| 63 | + VLBI_INCLUDE_DIRS |
| 64 | + VERSION_VAR |
| 65 | + VLBI_VERSION |
| 66 | +) |
| 67 | + |
| 68 | +mark_as_advanced(VLBI_INCLUDE_DIRS VLBI_LIBRARIES) |
| 69 | + |
| 70 | +if(VLBI_FOUND) |
| 71 | + include(CheckCXXSourceCompiles) |
| 72 | + include(CMakePushCheckState) |
| 73 | + cmake_push_check_state(RESET) |
| 74 | + set(CMAKE_REQUIRED_INCLUDES ${VLBI_INCLUDE_DIRS}) |
| 75 | + set(CMAKE_REQUIRED_LIBRARIES ${VLBI_LIBRARIES}) |
| 76 | + check_cxx_source_compiles("#include <vlbi.h> |
| 77 | + int main() { vlbi_get_version(); return 0; }" VLBI_HAS_VLBI_VERSION) |
| 78 | + cmake_pop_check_state() |
| 79 | +endif() |
0 commit comments